This is a discussion on Query question within the MySQL forums, part of the Database Server Software category; --> Please can somebody help me with this though query I have 2 fields in my table: owner and machine ...
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Please can somebody help me with this though query I have 2 fields in my table: owner and machine none of them are unique I want to do a query - as input I have a list of owners as output I need the machines, but only one jack radio jack computer jack cdplayer bill radio bill shoes larry shoes larry trouser larry gps kate cdplayer kate car as input I give 'jack AND bill AND larry' as output I need 'radio computer cdplayer shoes trouser gps' Can anybody help me? |
| ||||
| Jaak, you can use the keyword distinct in your select. Then you don't get duplicate data rows. select distinct owner, maschine from table where owner in ('jack','bill','larry') or if you only need the maschines select distinct maschine from table where owner in ('jack','bill','larry') brgd, Birthe Jaak wrote: > Please can somebody help me with this though query > > I have 2 fields in my table: owner and machine > none of them are unique > > I want to do a query - as input I have a list of owners > as output I need the machines, but only one > > jack radio > jack computer > jack cdplayer > bill radio > bill shoes > larry shoes > larry trouser > larry gps > kate cdplayer > kate car > > as input I give 'jack AND bill AND larry' > as output I need 'radio computer cdplayer shoes trouser gps' > > Can anybody help me? |