If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > sql help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 09-15-02, 23:26
jjreed34 jjreed34 is offline
Registered User
 
Join Date: Sep 2002
Posts: 1
Question 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.

Thanks
John
Reply With Quote
  #2 (permalink)  
Old 09-16-02, 05:08
alligatorsql.com alligatorsql.com is offline
Registered User
 
Join Date: Jul 2001
Location: Germany
Posts: 189
Cool Use Group and having clause

Hello,

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

Means

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

Hope that helps ?

Regards
Manfred
(Alligator Company)
http://www.alligatorsql.com
Reply With Quote
  #3 (permalink)  
Old 09-16-02, 13:51
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
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 ?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On