Reply
SQL Problems
Old 08-07-2007, 09:43 PM SQL Problems
Average Talker

Posts: 22
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
FuZion is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 08-08-2007, 03:08 AM Re: SQL Problems
tripy's Avatar
Fetchez la vache!

Posts: 1,958
Name: Thierry
Location: In the void
:-D
So you're spreading it further !?



http://codingforums.com/showthread.php?t=120834

lol, caught ya !
__________________
Listen to the ducky: "This is awesome!!!"

tripy is online now
Reply With Quote
View Public Profile
 
Old 08-08-2007, 10:42 AM Re: SQL Problems
Average Talker

Posts: 22
Ha ya got me but hey a second opinion never hurts!
FuZion is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to SQL Problems
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.12614 seconds with 13 queries