Hello,
I have a query which needs to pull the just the row ID from a table, but the row must meet certain requirements. The information is in 3 tables, linked by IDs, ssid, aid and TID are the ones I used in the query.. the other table just uses ID.
Here is the query:
Code:
SELECT si.id
FROM
trucks t,
service_sheets ss,
service_info si
WHERE ss.ssid=si.ssid
AND t.tid=si.tid
AND ss.aid=1
AND t.aid=1
AND date(ss.date)=date('07-02-2007')
AND si.hours=555
AND t.unit_num=123
AND si.mileage=88
The data in there is dummy data if you guys need to know what the table structure is let me know, I'm not very good with this complex SQL stuff.
Basically I want to pull the row id from the service_info table, in the service info table there is a service sheet id (ssid), which corresponds to the row in the service sheet table that this row belongs too. There is also a truck id (tid) that references the truck table so I can get the unit number.
Any help is greatly appreciated.
Thanks in advance!
FuZion
|