Select of multipel data from database

C

Claus G

Hello

I have this codeline:

Set rs = Conn.Execute("SELECT * FROM nyhedsbrev Where postnummer = 7430
")
Where the postcode 7430 is selected, but y nead to draw many ´specifik
numbers at the same time, as well as exclude others. Can anybody help?
Best regard.
 
M

Mark Rae

Set rs = Conn.Execute("SELECT * FROM nyhedsbrev Where postnummer = 7430")

Where the postcode 7430 is selected, but y nead to draw many ´specifik
numbers at the same time, as well as exclude others. Can anybody help?

SELECT *
FROM nyhedsbrew
WHERE postrunner IN (7430,7431,7432)
AND postrunner NOT IN (7433,7434,7435)
 
C

Claus G

Mark Rae skrev:
Where the postcode 7430 is selected, but y nead to draw many ´specifik
numbers at the same time, as well as exclude others. Can anybody help?

SELECT *
FROM nyhedsbrew
WHERE postrunner IN (7430,7431,7432)
AND postrunner NOT IN (7433,7434,7435)

Thank You it works, everything is so easy whwn you now have to do it. i
am very greatfull.
Claus G
 
M

Mark Rae

Thank You it works, everything is so easy whwn you now have to do it. i
am very greatfull.

No problem.

Don't take this the wrong way, but the T-SQL I gave you is *really* basic,
so you might benefit hugely from a beginner's guide...

Everybody has to start somewhere, and this sort of thing can be really
daunting without the basic building blocks...

Also, if you are building up SQL dynamically, you can run into problems with
SQL injection (Google it), so you should at least investigate using a stored
procedure / parameterised query if you can...
 

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,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top