Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
4.00/5 (3 votes)
See more:
Hi All,

I need to select data from one table on the basis of other table.

The first table has the required fields and reportid.

This reportid(same as first table), and username, current date fields are present in second table.

Now first i need to check if data is present in second table against that reportid in today's date and then if it is present, select data from first table.

I am really confused.

Please help me in this!

Thanks in Advance.
Posted
Updated 18-Jul-11 23:59pm
v3

1 solution

Try this.
VB
SELECT FT.* FROM firsttable FT INNER JOIN secondtable ST ON FT.reportid = ST.reportid AND date = 'date here'
 
Share this answer
 
v2
Comments
Ahsan Mirza 27-Jun-11 6:12am    
I only need to select data from first table.
Toniyo Jackson 27-Jun-11 6:15am    
Check the updated answer.
CS2011 27-Jun-11 7:10am    
5 for effort. I was thinking i'll just let him know that there is something called join.
Ahsan Mirza 27-Jun-11 7:19am    
Thanks "Toniyo Jackson" and yes i know about joins but i wasn't getting the right implementation. Anyways, thanks CS2011 too!
Toniyo Jackson 27-Jun-11 7:21am    
You are welcome :) Accept the answer

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900