Results 1 to 3 of 3

Thread: sql help

  1. #1
    Join Date
    Sep 2002

    Question Unanswered: sql help

    I have created a database consisting of client name, job name, street, town, job#, and map#.

    I have created an asp page that will search the database using drop down boxes from each field with "ANY" (%) as default choice. It works great!

    How can I create a query that will allow me to pick 2 or 3 streets and one town and have it return those results?? I have been using "SELECT distinct town FROM masterindex" because the table has a lot of duplicates. I have been able to choose(highlight) multiple streets on asp page but when it searches it returns nothing.

    Is it possible to use select distinct in this situation?

    My other option is to create 3 total street drop down boxes, the first one defaulted to "ANY" and the next two defaulted to "NONE" so if I dont want to search more than one street.

    Any help on this would be great.


  2. #2
    Join Date
    Jul 2001

    Cool Use Group and having clause


    I am not sure that I exactly understand what you want - but - what is about GROUB BY in combination with the HAVING clause...


    SELECT town from masterindex GROUP BY town having street = "Mystreet" ....

    Hope that helps ?

    (Alligator Company)

  3. #3
    Join Date
    Feb 2002
    Does the masterindex table consist of those fields you mention? What will it mean if a user select 1 city and 2 streets ? - Does it mean give me all records where the city is equal to the city selected AND where one of the 2 streets exists in the same record - or does it mean give me all records where the city is equal to the city selected OR the street is equal to 1 of the 2 streets ?

Posting Permissions

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