Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Select Statement help with where clause

Status
Not open for further replies.

ziggs

Technical User
Sep 21, 2000
195
US
Here's my current Select Statement:

SQL1 = "SELECT * From tbl_Business "
SQL1 = SQL1 & " Where ([Street Number] = " & Clng(Request.QueryString("dig")) & ") AND"
SQL1 = SQL1 & " ([Street Direction] = '" & Replace(Request.QueryString ("dir"), "'", "''") & "') AND"
SQL1 = SQL1 & " ([Street Name] = '" & Replace(Request.QueryString ("street"), "'", "''") & "') AND"
SQL1 = SQL1 & " ([Street Type] = '" & Replace(Request.QueryString ("type"), "'", "''") & "') AND"
SQL1 = SQL1 & " ([aptsuite] = '" & Replace(Request.QueryString ("apt"), "'", "''") & "')"

Now, the 2nd database that I'll be drawing off of has the location format of three parts instead of the five parts as seen above. Thus, I need to create a Where statment that will combine the three in the middle (above) into one.

In other words, the Street Direction, Street Name, and Street Type, must be combined into one. Any ideas?
 
Combined into one what? I don't get it...

What does the "combined" field look like in the second database??? comma separated or something?
 
Sorry for the confusion. My other database will populate the Request Querystrings since this is running off of another ASP. However, the same ASP let's you pick your own address.

Anyway, this is what I did. I was able to create a formula and called it FullStreet. Fullstreet will take Street Dir, Street Name, and Street type and combined them to one name (Example. S is dir, Abel is street, St is type. thus, fullstree = S Able St). Now, is it possile to apply to Select statement? I've never done a combination where clause before that combines 3 fields to one.

Here's the middle section for the full street:

SQL1 = SQL1 & " ([Street Direction] = '" & Replace(Request.QueryString ("dir"), "'", "''") & "') AND"
SQL1 = SQL1 & " ([Street Name] = '" & Replace(Request.QueryString ("street"), "'", "''") & "') AND"
SQL1 = SQL1 & " ([Street Type] = '" & Replace(Request.QueryString ("type"), "'", "''") & "') AND"


I need the where clause to combine the [Street Direction], [Street Name] and [Street type] to one field and then use the fullstreet formula against it. I'm probably thinking about how to do this the wrong way though. Any thoughts would be appreciated. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top