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
 General SQL Server Forums
 New to SQL Server Programming
 Select Query for reteriving data using 3 tables

Author  Topic 

teamjai
Yak Posting Veteran

52 Posts

Posted - 2015-04-21 : 03:23:07
Hi,

I want to retrieve the data from table "Document" and i need to check the below condition using 3 tables.

Document.ID=Project.ID=Group.ID

Here Project and Group is an another table.

Query : Select Document.Name from Document, Group, Project where
Document.ID = Group.ID and Document.ID= Project.ID.

is this right a way.

Could you please correct my Query.

Thanks

Maithil
Starting Member

29 Posts

Posted - 2015-04-21 : 04:29:13
Hi,

As Per Right Logic

Your Query Should be Like this

Select Document.Name from Document, Group, Project where
Document.GroupId = Group.ID and Group.ProjectID= Project.ID.
Go to Top of Page

nirene
Yak Posting Veteran

98 Posts

Posted - 2015-04-21 : 05:06:39
Hi,

Select Document.Name from Document D
Inner Join Group G On D.GroupId = G.ID
Inner Join Project P On G.ProjectID= P.ID

Nirene


Go to Top of Page

teamjai
Yak Posting Veteran

52 Posts

Posted - 2015-04-21 : 07:39:08
quote:
Originally posted by nirene

Hi,

Select Document.Name from Document D
Inner Join Group G On D.GroupId = G.ID
Inner Join Project P On G.ProjectID= P.ID

Nirene






Thanks You. its working fine
Go to Top of Page
   

- Advertisement -