Axel, > Simply translated: > > select * from table t1 > where t1.data_value=1 > AND not exists(select * from table t2 > where t2.data_value=2 > and t2.item_number = t1.item_number)
Yes, but with t1 and t2 the same table. best regards, Olivier > > > > Axel Diehl > __________________ > GIP Exyr GmbH > Hechtsheimer Str. 35-37 | 55131 Mainz > > Tel: +49 (0) 6131 / 80124 - 46 | Fax: +49 (0) 6131 / 80124 - 24 > E-Mail: axel.di...@gip.com | Web: www.gip.com <http://www.gip.com/> > > Geschäftsführer: Dr. Bernd Reifenhäuser, Dr. Alexander Ebbes > Handelsregister: HRB 6870 - Amtsgericht Mainz > > > > > -----Ursprüngliche Nachricht----- > Von: Olivier Nicole [mailto:olivier.nic...@cs.ait.ac.th] > Gesendet: Mittwoch, 29. April 2015 07:21 > An: mog...@fumlersoft.dk > Cc: mysql@lists.mysql.com > Betreff: Re: Select one valuebut not the other > >> SELECT * FROM table WHERE item_number=1; > > Sorry if my question was not clear: what I am looking for is: > > SELECT * FROM table WHERE data_value=1 AND "there is not any reccord with > the same item_number and data_value=2" > > Olivier > >> >> On Wed, April 29, 2015 06:30, Olivier Nicole wrote: >>> Hi, >>> >>> I am sure that it is feasible with MySQl, and I am sure that's a >>> newbie question, but my SQL skills are limited... >>> >>> I have a table where each record is made of one item_number and one >>> data_value. >>> >>> If one item has several values, there are several records with the >>> same item_number and a different data_value. >>> >>> What is the command to select all the records where an item_number >>> has the data 1 but not the data 2? >>> >>> Thanks in advance, >>> >>> Olivier >> >> -- >> Mogens Melander >> +66 8701 33224 >> >> >> -- >> This message has been scanned for viruses and dangerous content by >> MailScanner, and is believed to be clean. -- -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/mysql