Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 how to fetch records

Author  Topic 

nicklibee
Starting Member

2 Posts

Posted - 2011-03-27 : 03:17:03
Hello,

I have two tables and following are the structure of both the tables

Tbale 1
Field1 Field2 Field3
d1 01 26/03/2011
d2 02 26/03/2011
d3 03 27/03/2011

Table2
Field1 Field2 Field3
01 6.15 14.25
02 7.30 16.25
03 6.00 18.25


I wanted an output like the following if i search records by table1.field3 (say 26/03/2011)



Tbale 1
Table1.Field1 Table2.Field2 Table3.Field3 Table2.field2 Table2.Field3
d1 01 26/03/2011 6.15 14.25
d2 02 26/03/2011 7.30 16.25
d3 03 27/03/2011


Inorder to get the above result, what query should i write?

Kindly help me.

Thanks
Nick


nicklibee

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2011-03-27 : 03:49:18
first glance, it looks like you need an INNER JOIN, but can you explain why the result for d3, the value for field2 & field3 of Table2 is empty ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2011-03-27 : 10:08:59
and what is that? Table3.Field3


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-03-27 : 12:45:39
what's basis on which you're trying to join?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -