Click here to Skip to main content
14,355,239 members
Rate this:
Please Sign up or sign in to vote.
See more:
I have two tables:

sendsms with the fields smsID, driverIDS, Responses, driverMobileno
Driver with the fields driverid, name, mobileno

Now I want a query that displays driverid, name, driverMobileno, responses

How do I write this subquery?
Posted
Updated 8-Oct-10 3:44am
v3
Rate this:
Please Sign up or sign in to vote.

Solution 3

You can use INNER JOIN for your query.

like this.

SELECT t1.field1, t1.field2, t2.field1, t2.field2 FROM table1 AS t1 INNERJOIN table2 AS t2 ON ( t1.field1 = t2.field1 );


in which you should have one common fild in both table.

or You can use below one also.

SELECT s.driverid, d.name, s.driverMobileno, s.responses
FROM sendsms AS s, driver AS d
WHERE s.driverid = d.driverid
;


it will give field from both table.
   
v3
Rate this:
Please Sign up or sign in to vote.

Solution 1

   
Rate this:
Please Sign up or sign in to vote.

Solution 2

Join two tables using JOIN by DriverID

Look Here[^]

And try out yourself. I think that would be good for you to learn.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100