G
Guest
I am having some problems getting this query to work. When I remove the
DISTINCT constraint the query works great but it does not produce unique
results. When I add the DISTINCT constraint back into the query I get an SQL
CE error telling me that a column name is invalid.
Here is the query (with the DISTINCT constraint):
sqltext = "SELECT DISTINCT PestID,Pest FROM tblPests " & _
"WHERE (CustomerID = " & customerid & " " & _
"OR CustomerID = 1) " & _
"AND Active='Y' " & _
"AND (CustomerChemicalID = " &
spraying.chemicalid1 & " " & _
"OR CustomerChemicalID = " &
spraying.chemicalid2 & " " & _
"OR CustomerChemicalID = " &
spraying.chemicalid3 & ") " & _
"ORDER BY CustomerID DESC, Pest ASC;"
Does anyone have any suggestions on this or know what in the world that I am
doing wrong? I am quite sure it is syntax related.
Thanks in advance,
nb
DISTINCT constraint the query works great but it does not produce unique
results. When I add the DISTINCT constraint back into the query I get an SQL
CE error telling me that a column name is invalid.
Here is the query (with the DISTINCT constraint):
sqltext = "SELECT DISTINCT PestID,Pest FROM tblPests " & _
"WHERE (CustomerID = " & customerid & " " & _
"OR CustomerID = 1) " & _
"AND Active='Y' " & _
"AND (CustomerChemicalID = " &
spraying.chemicalid1 & " " & _
"OR CustomerChemicalID = " &
spraying.chemicalid2 & " " & _
"OR CustomerChemicalID = " &
spraying.chemicalid3 & ") " & _
"ORDER BY CustomerID DESC, Pest ASC;"
Does anyone have any suggestions on this or know what in the world that I am
doing wrong? I am quite sure it is syntax related.
Thanks in advance,
nb