If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > values from two table

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 08-22-09, 05:32
fernandodonster fernandodonster is offline
Registered User
 
Join Date: Feb 2009
Posts: 2
Wink values from two table

I have 2 tables vehicle and worker.
number of workers under a vehicle mau be 10 or 25.
vehicle(veh_id(pimary key),vehicle name, details)
worker(work_id(pimary key),veh_id(foreign key),worker name)
i have to list all records from vehicle table and to count how many workers exists under a vehicle.
if no workers under a vehicle indicate 0.

what i need is that It should be with asingle query.

i have to list all date from vehicle table and to list how many workers under a vehicle(i mean count the workers)???


Last edited by fernandodonster; 08-25-09 at 01:56.
Reply With Quote
  #2 (permalink)  
Old 08-22-09, 07:19
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
Quote:
Originally Posted by fernandodonster
what i need is that It should be with asingle query.[/B]
hint: LEFT OUTER JOIN

(we do not do homework assignments on this site, but we will help you as you do the work)
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

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