Requesting help with creating an SQL query to select similar records
This is a little hard to explain but I will do my best. I need to write/update the example query below so that it will return the records requested, but also return records based on what was returned. In my example below, two records are returned with "carnumber 55". I want to show those 2 records, but also any other records with the same "carname". In my example below, 3 additional records are displayed because they have the same car name as those returned from the original query. Can someone assist?
Select id, carnumber, carnamefrom tblOne where carnumber = 55What I want returned from the new queryid | carnumber | carname1 | 55 | bobs car5 | 55 | johns car7 | 88 | bobs car8 | 77 | bobs car21 | 97 | johns car
try this
select * from table01
where carname = 'bobs car'
order by carnumber
earwig75
ASKER
@muhammad, I will not have the carname in my query, I will only have the carnumber, that's why I need to use the results from the initial query to get the carname.
select * from table01
where carname = 'bobs car'
order by carnumber