I have 9 fields and I need to see all the data from these fields which have a particular set of IDs. Could any one tell me the SQL query for it?
Ex: Database contains 100 records. I need to select a list of 20 IDs from the field BusID and it’s corresponding rows.
SELECT *
FROM `Buses`
WHERE `BusID` I am stuck after this.. how do I put in the list of 20 BusIds here?
If you know the list of ids try this query:
or if you pull them from another table
list of busIdscould be another subquery:If you need to compare to another table you need a join: