By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,384 Members | 714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,384 IT Pros & Developers. It's quick & easy.

Query to return same record more than once

P: n/a
I have a table that holds customer contact information. The table has
three email fields (Email1, Email2, and Email3). So each customer can
have up to 3 contact email addresses.

I need a query that will return the customers name with each of their
email addresses.

ie If customer has 3 email addresses then following is returned:

Bill Morrison Email1
Bill Morrison Email2
Bill Morrison Email3

Hope this makes sense

Thanks
Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

It would be better to put the email addresses in a separate table. This
will Normalize your db. E.g.:

Customers CustEmails
- ----------- ---------------
CustID 1-->m CustID,
<other fields> Email

This way you can have many emails per customer.

The query would be like this:

SELECT C.FirstName & " " & C.LastName, E.Email
FROM Customers As C INNER JOIN CustEmails As E
ON C.CustID = E.CustID
WHERE <criteria>

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQUx1WoechKqOuFEgEQIMxACgj9FpY+U7KVzcsV4ki3QoJh iMwwIAn1h+
ebU4MjL0nKj1efejTVu/lkXo
=bigj
-----END PGP SIGNATURE-----
Bill Morrison wrote:
I have a table that holds customer contact information. The table has
three email fields (Email1, Email2, and Email3). So each customer can
have up to 3 contact email addresses.

I need a query that will return the customers name with each of their
email addresses.

ie If customer has 3 email addresses then following is returned:

Bill Morrison Email1
Bill Morrison Email2
Bill Morrison Email3


Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.