Need help finishing a simple query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello,

In the FrontPage discussion group I asked a question about a query and I
received the following response:

select * from table where fieldname like '::letter::%'
if you're coding this you can do
<%
sql="select * from table where fieldname like '" &
request.querystring("letter") & "%'"
' execute your query
%>

I started to attempt to do this query and here is as far as I got

SELECT Labels.Label, Labels.Name, Labels.Picture
FROM Labels
WHERE ((Labels.Name) Like

Any sort of help is welcomed.

Thank you in advance
 
Sam

If you are querying an "Access" (Jet) backend, you need to use the
appropriate wildcard character for Jet, i.e., the asterisk "*" ( e.g., Like
Sam*)

If you are using an MS SQL-Server backend, the wildcard is, I believe, a
percent sign "%".

If you are using another backend, you'll need to know what wildcard
character is used ...
 
(and just in case I missed what you were asking for...)

Consider opening a query in design mode in Access, creating the query, then
clicking on the design tool drop-down and selecting SQL to see how Access
generates the "Like ..." statement.
 
Thanx Jeff,

I am actually using the query in FrontPage. I do not know the SQL code that
is necessary to finish the suggestion I mentioned early. I need someone to
help me finish the query I started.

Sam
 
In the FrontPage discussion group I asked a question about a query and I
received the following response:

What is the database engine for the query? SQL/Server? Access .mdb or
..mde file? An Access .adp file (which is SQL/Server)?

The syntax for the LIKE operator is different: SQL uses % as the
wildcard, Access uses *. It would also help to know what is in the
criterion and what is in the field you're searching, and what sort of
wildcard match you have in mind.

John W. Vinson[MVP]
 
And, in Visual Basic Script (which I believe is what FrontPage uses), ADO
recordsets are used, so the query needs to use the wildcards for ADO, which
is % for any character.
 
I am using a .mdb database directly saved in my Frontpage web. Maybe it
would be best if I describe what I'm trying to accomplish. The page would
have the alphabet across the top. When a user clicked on the letter the
query would run based on the letter clicked. Instead of using 26 different
queries I want to only use one that covers all 26 letters. The fields are
only Label, Name, and Picture in tabel Label. I can either draw from the
query in the database or FrontPage allows me to enter the query directly into
FrontPage. I do understand that the % character replaces the * when using
FrontPage. I'm just not sure how to create the query that will achieve the
result I'm looking for. I don't have much SQL knowledge and I have close to
ZERO VB knowledge.

Sam
 
Back
Top