Hi, You can try something like this : select (CASE WHEN Data2<>141 THEN Data1 END) from your_table where Data3=1 group by Data1;
Regards, Gelu _____________________________________________________ G.NET SOFTWARE COMPANY Permanent e-mail address : [EMAIL PROTECTED] [EMAIL PROTECTED] ----- Original Message ----- From: "Luc Foisy" <[EMAIL PROTECTED]> To: "MYSQL-List (E-mail)" <[EMAIL PROTECTED]> Sent: Monday, August 19, 2002 6:32 PM Subject: Query Question Some ficticious data ID Data1 Data2 Data3 1 1 141 1 2 5 140 1 3 4 142 1 4 3 141 1 5 2 142 1 6 5 142 1 7 7 140 1 8 2 143 1 9 3 142 1 10 3 143 1 11 4 144 1 12 2 144 1 13 8 141 2 14 9 140 2 15 6 142 2 16 11 141 2 17 0 142 2 18 9 142 2 19 10 140 2 20 0 143 2 21 11 142 2 22 3 143 2 23 6 144 2 24 0 144 2 For my return I only want a single instance of "Data1", so it will most likely need be GROUP BY Data1 I would like those records to include the "group" that does not contain a "Data2" value of 141 There is also a WHERE clause on "Data3" = 1 The return would include these values for Data1 7 5 2 4 Is there some way to do this with a single query? If this is unclear, let me know Luc Foisy Technical Magic - www.technical-magic.com 1 Stafford Road, Suite 325, Nepean, Ontario, K2H 1B9 Phone: (613) 721-8850 Fax: (613) 596-5096 E-Mail: [EMAIL PROTECTED] <<<<< Fulfilling the Promise of Technology >>>>> --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php