Select of multipel data from database

  • Thread starter Thread starter Claus G
  • Start date Start date
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.
 
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)
 
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
 
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...
 
Back
Top