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)
 Inner Join with a Distinct

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-09-17 : 10:20:10
Chad Hullender writes "I am having difficulty getting this SQL query to work, not only in SQL analyzer, but in my ASP code. Basically, I have two tables with the following fields:

Members - AADV_NR, BRAND
Partners - BRAND, BRND_DESC

There are several instances of AADV_NR in the members table and I only want DISTINCT occurences of each BRAND. So, what I have done is an INNER JOIN on BRAND with a DISTINCT BRND_DESC....yet it doesn't work. The AAnumber is a value retrieved from a previous form (and that part works fine in a simple SELECT query). Any ideas?

strSQL = "SELECT DISTINCT PARTNERS.BRND_DESC FROM PARTNERS JOIN MEMBERS ON PARTNERS.BRAND = MEMBERS.BRAND WHERE MEMBERS.ACCT_NR = '" & AAnumber & "'""
   

- Advertisement -