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 2000 Forums
 Transact-SQL (2000)
 Simple SQL Question

Author  Topic 

TGarmon
Starting Member

18 Posts

Posted - 2002-03-15 : 17:27:02
I have two tables. One called VNDR with the information below in it.

VNDR_Num VNDR_Code VNDR_Subcode VNDR_Seq
abc123 2 12 1
abc123 2 9 2
abc123 2 13 3
xyz 2 25 1

Another called FLDS:

FLDS_Code FLDS_Subcode
2 14
2 25
2 9
2 13
2 12
3 14

I am needing a query that will select ALL FLDS_Subcode where FLDS_Code is equal to VNDR_Code based on VNDR_Num. Here is the part I am having trouble with: I need the VNDR_Seq displayed next to corresponding FLDS_Subcode. This is what I am looking for:

FLDS_Subcode VNDR_Seq
14
25
9 2
13 3
12 1

Can this be done?

yahazim
Starting Member

13 Posts

Posted - 2002-03-15 : 18:20:01
<where FLDS_Code is equal to VNDR_Code based on VNDR_Num>

You really have to be clearer with this statement.

1) Is VNDR_Num a foreign key? If so how come it's not in the VNDR table?

2) Or, are you just matching records FLDS_Code = VNDR_Code?

???



Go to Top of Page

AK
Starting Member

27 Posts

Posted - 2002-03-18 : 13:12:07
quote:


how about:

select FLDS_Subcode, VNDR_Seq
from FLDS left join VNDR
on FLDS.FLDS_Subcode=VNDR.VNDR_Subcode




Go to Top of Page
   

- Advertisement -