Tough question.. I think

Results 1 to 2 of 2

Thread: Tough question.. I think

  1. #1
    Join Date
    Dec 1969

    Default Tough question.. I think

    Hi there,<BR><BR>here is my scenario:<BR><BR>I have four different "city" fields (eg. city1, city2, city3...) in my access database. Now, I want to be able to search through all the 4 cities fields but only display the "distinct" total of the 4 cities combined.<BR><BR>For example.. <BR>if one member in my database has the following cities listed:<BR>City1 = New York<BR>City2 = Chicago<BR>City3 = Los Angeles<BR>City4 = San Diego<BR><BR>and another member has the cities listed:<BR>City1 = Chicago<BR>City2 = New York<BR>City3 = Orlando<BR>City4 = Miami<BR><BR>then after running a search from a searchpage I only want to display: New York, Chicago, Los Angeles, San Diego, Orlando, Miami<BR><BR>instead of:<BR>New York, Chicago, Los Angeles, San Diego, Chicago, New York, Orlando, Miami<BR><BR><BR>What would be the best way of doing this?<BR>(I hope this is somewhat understandable)<BR><BR>Thanks in advance for all your help!<BR><BR>andre<BR>

  2. #2
    Sanjay Bedre Guest

    Default RE: Tough question.. I think

    I had a similar case in which I had get distinct Artist Names from 4 Artist fields. It worked for me. In your case the sql should be. This sql will fetch you distinct Cities from 4 different columns<BR><BR>&#060;%strSQL = "Select Distinct City1 As City From Table union " & _<BR> "Select Distinct City2 From Table union " & _<BR> "Select Distinct City3 From Table union " & _<BR> "Select Distinct City4 From Table"<BR>%&#062;<BR><BR>I hope this works <BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts