tumby1974
Posts: 26
|
Posted: 05/13/2011, 8:21 AM |
|
I'm using autocomplete so a user can type the first few numbers / letters of a street address, and it will bring up a list that match what they are typing.
The autocomplete is looking at Job Address field to get the results.
However, if there are more than one records with the same Job Address, then the autocomplete result shows all of them.
ex. if user starts typing 123 (for 123 Apple St) and let's say there are 5 records in the DB with job address of "123 Apple St", in the autocomplete it will show all 5 of those.
How can you make it to just show one distinct result? Do I have to add a DISTINCT somewhere in the SQL for this feature?
|
|
|
solesz
Posts: 137
|
Posted: 05/17/2011, 10:30 PM |
|
Hi,
Definitely you have to use DISTINCT in SQL.
If you set up your query using [Build Query] button, then switch to SQL using drop-down list on the upper-left. Then add distinct.
Drawback of this solution, that after switching to SQL and edit the code you can't use the visual query mode (Table) anymore. So prepare your query 100%, then switch to SQL.
Another solution to duplicate your table - in database system - into a view, where Distinct already applied. Then you can editing your query in codecharge without any problem. Surely it is not the nicest way...
solesz
|
|
|
|