two columns into one

  • Thread starter Thread starter Susan Grand
  • Start date Start date
S

Susan Grand

Hello,
I have a query where I need to pull two different columns
that contain the same type of data (email addresses) Can
someone tell me how to query these into the same result
column so I can sort and use them all as one group?
Thanks!

Susan G
 
Susan,

I'm assuming that you've got 2 columns where either on or the other is
blank/empty, and you want to see them as if they were 1 column with data,
right?

In the query designer, try this type of query expression (tailor to fit your
field names):

eMailAddr: iif(isnull([EmailFieldName1]), [eMailFieldName2],
[eMailFieldName1])

- Mark
 
Hello,
I have a query where I need to pull two different columns
that contain the same type of data (email addresses) Can
someone tell me how to query these into the same result
column so I can sort and use them all as one group?
Thanks!

Susan G

Mark's suggestion will work if one or other of the addresses may be
NULL; if you want to get two records with two different EMail
addresses extracted from your current record, a UNION query will also
work. You'll need to go to the SQL window to do this; it'll be
something like

SELECT thisfield, thatfield, EMail1 FROM table
WHERE Email1 IS NOT NULL
UNION
SELECT thisfield, thatfield, EMail2 FROM table
WHERE Email2 IS NOT NULL

The need to do this suggests that you might want to use this UNION
query to create a MakeTable query; you seem to have a one-to-many
relationship between records and EMail addresses, and it should best
be stored as a one to many relationship in two tables!
 
Back
Top