Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

SQL HELP

Posted 09 Dec 2005 09:59:17
1
has voted
09 Dec 2005 09:59:17 Malcolm X posted:


Hey to all.

I have played around with SQL and so far have not been successfull.
Can anyone suggest or post what my SQL statment should read.
I have included the following information.

Database Name: datab.mdb
Table Name: tblQuery1
Column Names: name
location
description
Recordset Name: redord1

If I have left anything out please ask me.

Thanks for all your help.

Mally.

Replies

Replied 09 Dec 2005 10:17:51
09 Dec 2005 10:17:51 Malcolm X replied:
REVISED
Hey to all.

I have played around with SQL and so far have not been successfull.
Can anyone suggest or post what my SQL statment should read.
I have included the following information.

Database Name: datab.mdb
Table Name: tblQuery1
Column Names: name
location
description
Recordset Name: redord1

Results Page Name: result.asp

Search Page Name: search.asp
Search Page Filed Names:
Textfield: keywordSearch
List/Menu: category
List/Menu: location

If I have left anything out please ask me.

Thanks for all your help.

Mally.
Replied 09 Dec 2005 17:57:45
09 Dec 2005 17:57:45 August Malson replied:
Sure,

based off the information that you have provided:

your sql statement should read something like this

select * from tblQuery1
where name like '#keywordSearch#%'
and location = '#location#'

Replace the "#" with the variable names of your desired language. I am not sure what the variable name structure is for ASP.

Good Luck!
Replied 10 Dec 2005 01:24:05
10 Dec 2005 01:24:05 Malcolm X replied:
Heya, can I say that the way I have written this is correct?

SELECT *
FROM Query1
WHERE TimberSpecies LIKE '%MMColParam%' AND CategoryTable LIKE '%MMColParam2%' AND Location LIKE '%MMColParam3%'

MMColParam 1 Request.Form("keywordSearch"
MMColParam 2 Request.Form("CategoryTable"
MMColParam 3 Request.Form("Location"

Also in this book I have it says that instead of having this at the beginning,

SELECT *

I should have something like this.

SELECT [Don't use *; select what you need]'

I dont understand this line, what can I put in the place of *?

Mally.
Replied 10 Dec 2005 05:39:26
10 Dec 2005 05:39:26 Dave Thomas replied:
the * means ALL

so SELECT * = SELECT ALL RECORDS

which isn't a good thing when you only need to target a specific field in the search [especially on an access db]

you can replace it with the actual field names in the table

like <b>SELECT name, location FROM tblQuery1</b> this sql would omit the description field and therefore use less resources everytime the db is called upon.

regards

Dave Thomas
<b>DMX Zone Manager</b>
Replied 10 Dec 2005 05:49:43
10 Dec 2005 05:49:43 Malcolm X replied:
Ok, so this looks better?

SELECT SupplierName, Location, ShortDescription
FROM Query1
WHERE TimberSpecies LIKE '%MMColParam%' AND CategoryTable LIKE '%MMColParam2%' AND Location LIKE '%MMColParam3%'

MMColParam 1 Request.Form("keywordSearch"
MMColParam 2 Request.Form("CategoryTable"
MMColParam 3 Request.Form("Location"

When I test this SQL i get the following error message.

[Microsoft][ODBC Microsoft Access Driver] Too Few Parameters. Expected 1.

Mally.

Reply to this topic