Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Statement to extract more than one line?

Status
Not open for further replies.

loner

IS-IT--Management
Jul 2, 2003
6
US
I want to extract many e-mails from this Access database, but I get an error or it doesn't extract properly every time I run the script.

This one runs fine:
SELECT panalists.EMAIL
FROM panalists
WHERE (((panalists.EMAIL)="02hsegurity@prtc.net"));

But this one fails:
SELECT panalists.EMAIL
FROM panalists
WHERE (((panalists.EMAIL)="02sandhsegurity@prtc.net" & " lt705@hotmail.com"));

Or even:
SELECT panalists.EMAIL
FROM panalists
WHERE (((panalists.EMAIL)="02sandhsegurity@prtc.net" , " lt705@hotmail.com"));

I just want to extract both e-mails from database, can anyone help?

Thanks,
C

 
WHERE (((panalists.EMAIL)="02sandhsegurity@prtc.net or lt705@hotmail.com"));
 
That does work, but I'm looking to extract both e-mails at one time, not one or the other.
 
This will extract both emails, what the statement is saying is select all panalists.EMAIL From the table Panelists Where the email is either 02sandhsegurity@prtc.net or lt705@hotmail.com"
 
Yeah, that does work, but for some reason, it's giving me a list of 1500 emails.

Here's the query:
SELECT panalists.EMAIL
FROM panalists
WHERE (((panalists.EMAIL)="02sandhsegurity@prtc.net" or "lt705@hotmail.com"));

Any idea?
 
Try this
SELECT panalists.IDField, panalists.EMAIL
FROM panalists
WHERE panalists.EMAIL in ("02sandhsegurity@prtc.net", "lt705@hotmail.com");
 
Don't know what I was thinking to use the OR it should be like:
WHERE panalists.EMAIL="02sandhsegurity@prtc.net" or panalists.EMAIL="lt705@hotmail.com";
So for what you are trying to do use the IN statement.
 
Thank you, DrJavaJoe, that worked :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top