473,387 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

"query contains" help please

Hi,

I'd like to adapt the query below to select records only if the Title field
contains the string "Book" (as an example).

I'd also like to use a different variant of the query elsewhere to select
all records where the Title field does not contain the string "Book".

I know my question sounds dumb to many, but I haven't worked with .ASP in a
while, and don't know how to put "Contains" and "Doesn't contain" in a
query, and can't seem to find this info easily at aspin.com

Many thanks for assistance.

David

set rsData = MyConn.execute("select URL,Counter,Title from HitTable ORDER BY
Counter DESC")
arData = rsData.getrows
Jul 19 '05 #1
3 1401

"David" <da***@brown6669.freeserve.co.uk> wrote in message
news:%B**************@newsfep3-gui.server.ntli.net...
Hi,

I'd like to adapt the query below to select records only if the Title field contains the string "Book" (as an example).
What kind of database?

select URL,Counter,Title from HitTable WHERE Title LIKE '%Book%' ORDER BY
Counter DESC

I'd also like to use a different variant of the query elsewhere to select
all records where the Title field does not contain the string "Book".
select URL,Counter,Title from HitTable WHERE Title NOT LIKE '%Book%' ORDER
BY Counter DESC

I know my question sounds dumb to many, but I haven't worked with .ASP in a while, and don't know how to put "Contains" and "Doesn't contain" in a
query, and can't seem to find this info easily at aspin.com


It's not dumb!

Ray at work
Jul 19 '05 #2
This is more to do with T-SQL statements rather than asp, to have a
condition where a string must contain somethin you use LIKE

set rsData = MyConn.execute("select URL,Counter,Title from HitTable WHERE
Title LIKE '%Book%' ORDER BY Counter DESC")

The % marks around Book, state that Book can be located anywhere in the
string so a book called aaaaBookaaa would be returned as would aaaaBook and
Bookaaa

If you left out the preceding % like this 'Book%' then only 'Bookaaa' would
be returned

"David" <da***@brown6669.freeserve.co.uk> wrote in message
news:%B**************@newsfep3-gui.server.ntli.net...
Hi,

I'd like to adapt the query below to select records only if the Title field contains the string "Book" (as an example).

I'd also like to use a different variant of the query elsewhere to select
all records where the Title field does not contain the string "Book".

I know my question sounds dumb to many, but I haven't worked with .ASP in a while, and don't know how to put "Contains" and "Doesn't contain" in a
query, and can't seem to find this info easily at aspin.com

Many thanks for assistance.

David

set rsData = MyConn.execute("select URL,Counter,Title from HitTable ORDER BY Counter DESC")
arData = rsData.getrows

Jul 19 '05 #3
Thanks for the help guys - works great!

David
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Robin Tucker | last post by:
Hi, I would like to select records from a table where the following criteria hold: SELECT * from Mytable where field x "contains" string @X or
2
by: Ellen Manning | last post by:
Using A2K. In my table I have the field "Grant" which can have a value or be null. I have a query that counts the number of records and has a Where clause on the Grant field. The query won't...
2
by: Zygo Blaxell | last post by:
I have a table with a few million rows of temperature data keyed by timestamp. I want to group these rows by timestamp intervals (e.g. every 32 seconds), compute aggregate functions on the...
7
by: =?Utf-8?B?UmljaA==?= | last post by:
Hello, I need to check if a textbox (of size = 1) contains a specific value (character). I could say something like If txt1.text.equals("X") or txt1.text.equals("Y")... then... Ideally, I...
3
by: geebanga88 | last post by:
Hi i am using oracle sql developer and am making a sub query for a question. The question states: "Find Name of patients who have been treated by Dr Brian or who have had an Extended...
4
by: seberino | last post by:
I'm looking over the docs for the re module and can't find how to "NOT" an entire regex. For example..... How make regex that means "contains regex#1 but NOT regex#2" ? Chris
1
by: yawnmoth | last post by:
<?php $content = ' <a> <d> <b> <c/><c/> </b> </d> <b> <c/><c/><c/>
8
geolemon
by: geolemon | last post by:
I'm trying to perform an update, and I can't avoid this error - I've tried this query what must be 5 different very fundamentally different ways now. Arg. I used to be a DBA in large DB2 and SQL...
2
ram09
by: ram09 | last post by:
I have an application that successfully runs locally, and it is ok... but when I tried deploying it, the web page contains only "submit query" text and nothing else... do anyone encounter this...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.