help on joining two tables

By shabana1128 ·
I am new to SQL server.Working for SQL Server 2000.
I have two tables which are related twice
as my first table(master) is having a column named "KeyId" and
second table(child) is containing two columns AttrId ,Units# these two are foreign keys to the single column "KeyId" of first table(master).

I need to get the matching values of the two Columns from a single query which am unable to get.

The query which i used is

select Dic.AttrName as PropName, mat.AttrValue, mat.AttrMinValue, mat.AttrMaxValue,Dic.Category,Dic1.AttrName
from Materials mat, DictionaryTable Dic ,DictionaryTable Dic1
where mat.Rspec# =@p1 and
mat.Rev# =@p2 and
Dic.Category like @p3 and
mat.AttrId = Dic.KeyId and
mat.Units# = Dic1.KeyId

Pls suggest me a better approach how to join the two tables twice?...

thanks in advance..


This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Related Discussions

Related Forums