Forum Moderators: open

Message Too Old, No Replies

Need a simple ASP database select statement

         

kevinj

9:30 pm on May 18, 2005 (gmt 0)

10+ Year Member



I am setting up a select statement that needs to select each unique email address in a database. Since some email addresses appear more than once, I only want to select 1 instance of each email address. Can someone help me modify what I have so far?

Set RS = DB.execute("SELECT * FROM exhibitor_housing WHERE (BILLING_EMAIL <>'')")

I need to know how to add the check for unique email addresses so I don't select more than 1 record with the same email address.

Thanks!

txbakers

10:44 pm on May 18, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if all you want is the email:

Set RS = DB.execute("SELECT DISTINCT email FROM exhibitor_housing WHERE (BILLING_EMAIL <>'')")

If you want other data as well, you will have to get more creative and loop through records.

kevinj

12:03 am on May 19, 2005 (gmt 0)

10+ Year Member



Perfect! Works great. Thank you.

Easy_Coder

1:27 pm on May 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



kevinj try to avoid using --> 'select *' to pervent full table scans from occurring too.

kevinj

1:45 pm on May 19, 2005 (gmt 0)

10+ Year Member



Thanks Easy_Coder. I've gotten into that bad habit. Will definitely keep it in mind on the next select statement I build.