SQL Where <> help with syntax

I

iam247

Hi

I am fairly inexperienced with ASP, SQL and VB Script.

In one of my web pages I am trying to search a table in access which
has a number of integers (GroupID's) (1 to 5 at present) and find those
which do not match another set of GroupID's already contained in a
record set named rsGroupsJ (1 to 4 at present).

I want to find the GroupID's which do not match ie GroupID

I have created the following sql which returns the error:
"Unterminated string constant"

strSQL3 = "SELECT tblGroups.* FROM tblGroups WHERE tblGroups.GroupID <>
(rsGroupsJ("GroupID"))"

The following sql does not create an error message but the WHERE bit
seems to be ignored - it returns all records 1 to 5, it should only
return 5

I am realy poor at creating sql statements, I am never sure where or
why to put " or &

I have looked at a number of tutorials but cannot find examples close
to my requirements.

Any help with this would be appreciated

ColinK
 
B

Bob Barrows [MVP]

Hi

I am fairly inexperienced with ASP, SQL and VB Script.

In one of my web pages I am trying to search a table in access which
has a number of integers (GroupID's) (1 to 5 at present) and find
those which do not match another set of GroupID's already contained
in a record set named rsGroupsJ (1 to 4 at present).

I want to find the GroupID's which do not match ie GroupID

I have created the following sql which returns the error:
"Unterminated string constant"

strSQL3 = "SELECT tblGroups.* FROM tblGroups WHERE tblGroups.GroupID
<> (rsGroupsJ("GroupID"))"

Do
response.write strsql3

to see the esult of this concatenation.

The following sql does not create an error message but the WHERE bit
seems to be ignored - it returns all records 1 to 5, it should only
return 5

See above
I am realy poor at creating sql statements, I am never sure where or
why to put " or &

Forget concatenation. Create your query in Access and verify that it works.
That'st the only way to see if you're doing it correctly.
I have looked at a number of tutorials but cannot find examples close
to my requirements.

Any help with this would be appreciated

ColinK

All right, you're depending too much on multiple recordsets, but, here's my
take on the rule for delimeters:
http://groups-beta.google.com/group.../713f592513bf333c?hl=en&lr=&ie=UTF-8&oe=UTF-8

Bob Barrows
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top