|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Select Distinct
Ok, I'm not sure why this isn't working. I have a simple query, where I need one feild to just return the distinct records, and the other to return whatever is in it.
SQLQuery = "SELECT DISTINCT STREETDESCRIPTION, CIVIC FROM Address_Data order by STREETDESCRIPTION" This however does not return the distinct streetdescription, but instead returns a bunch of duplicates. I have to remove, the Civic column out of the query to get the Streetdescription to be unique. How can I correct this? Do I need to create a loop and have a seperate Streetdescription query and civc query? That seems to be a bit much. any hellp would be greatly appreciated, thanks. |
|
#2
|
||||
|
||||
|
Code:
SELECT DISTINCT StreetDescription, Civic FROM Address_Data GROUP BY StreetDescription You will get duplicate StreetDescriptions if you have something like this Code:
StreetDescription Civic A 1 A 2 A 3 etc... Because it is also pulling the DISTINCT Civic field, and all of those above would be distinct. |
|
#3
|
|||
|
|||
|
hmm, well what the query is for, is to populate a dropdown list of streetdescriptions for the user to choose from. There is also a text box for the user to type in a Civic address, which is not a dropdown.
The reason included the civic number was for the variable to be passed to another page after they have populated the fields. Maybe I don't need the civic number in the query then. ?? |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > Select Distinct |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|