Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> RE: Query help !!!
Is 'F' the largest value? If so, then:
SELECT customer_id FROM ( SELECT customer_id , SUM(DECODE(status,'F',1,0)) stat_f , SUM(DECODE(status,'F',0,1)) stat_no_f FROM my_table GROUP BY customer_id ) WHERE stat_f > 0 AND stat_no_f > 0;
should work. May not be the best way, but I THINK it'll get the job done!
Good luck!
Rich Jesse System/Database Administrator Rich.Jesse_at_qtiworld.com Quad/Tech International, Sussex, WI USA
STANDARD DISCLAIMER APPLIES! (Code is "as-is", no warranties, etc)
-----Original Message-----
Sent: Friday, June 22, 2001 12:52
To: Multiple recipients of list ORACLE-L
Hi,
If I have this:
Customer_id Status
---------- -----------
1 F 1 A 1 B 2 F 2 F 3 A 3 B
How do I found out a customer who has both F and not F
for them. (If he only gets F, or gets other than F,
that's fine). In this case, I should get 1. Thank
you! I need this badly!
--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author: Jesse, Rich
INET: Rich.Jesse_at_qtiworld.com
Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051 San Diego, California -- Public Internet access / Mailing Lists --------------------------------------------------------------------To REMOVE yourself from this mailing list, send an E-Mail message to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in the message BODY, include a line containing: UNSUB ORACLE-L (or the name of mailing list you want to be removed from). You may also send the HELP command for other information (like subscribing). Received on Fri Jun 22 2001 - 12:34:21 CDT
![]() |
![]() |