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.
| Author |
Topic |
|
Fflyer
Starting Member
8 Posts |
Posted - 2001-09-13 : 11:51:57
|
| This may be hard to explain but an example is in order.Table 1 contains ID, BRANDNUMBERTable 2 contains BRANDNUMBER, BRAND_DESCRIPTIONI am querying Table 1 for the first 10 distinct BRANDNUMBERS (on a join between the two tables) and returning the BRANDNUMBER and BRAND_DESCRIPTION. Where do I put the BRAND_DESCRIPTION field name in the SQL string? If I put it next to the DISTINCT BRANDNUMBER then the DISTINCT gets applied to the BRAND_DESCRIPTION as well, which I don't want. Does that make sense?My query as it is now looks like:SELECT DISTINCT TABLE2.BRANDNUMBER, TABLE2.BRAND_DESCRIPTION FROM TABLE2 INNER JOIN MEMBERS ON TABLE1.BRANDNUMBER = TABLE2.BRANDNUMBER WHERE TABLE1.ID = '" & IDnumber & "'"IDnumber is retrieved from an HTML form.Thank you,Chad |
|
|
|
|
|