Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
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.
i have a student details table and staff details table and a library table now i need to fetch the code in the library and print the names from student detail table and staff details tablecan i query like thisselect library.id, (student_details.stud_name or staff_details.staff name , .....venkatesh
webfred
Master Smack Fu Yak Hacker
8781 Posts
Posted - 2009-07-11 : 13:39:46
You have to join the tables.If you can show table structure and wanted output (best with example data) we can show you the select.No, you're never too old to Yak'n'Roll if you're too young to die.
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2009-07-12 : 03:55:13
something like
SELECT l.memberidcoalesce(sd.staffname,std.studentname) as membername,coalesce(sd.staffcode,std.studentcode) as membercode,...FROM library lleft join staffdetails sdon sd.staffid=l.memberidleft join studentdetails stdon std.studentid=l.memeberid
i've just given a sample query with some column names but you need to replace actual table and column names in it