Union Query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to utilize a Union Query and need help regarding the proper syntax.

What I want to do is change the following code into a union query so that
the tblRaceData.P1Avg is added to the SQLRaceList without removing records
upon which valid data does not exist. In other words, if I start with 1000
records in table a, I still want to end up with the same 1000 records but
have the new data stored accordingly in tmpET.

strSQL = "SELECT SQLRaceList.HN, SQLRaceList.Program, " & _
"SQLRaceList.Race, tblRaceData.P1Avg INTO tmpET " & _
"FROM SQLRaceList " & _
"LEFT JOIN tblRaceData ON SQLRaceList.HN = tblRaceData.HN"

Thanks for looking at this for me and I hope I explained what I am trying to
accomplish.
 
hi,
union querys combine 2 or more tables or querys fields
into one field. in theory if you have 2 querys that have 5
fields each and each return 1000 records then the union
query would have 5 fields and 2000 records.
so you just can't add..... you must combine.
What field do you want tblRacdDate.P1Avg combined with?
as i read your code it seem to be added in a field by
itself in a left join relation between SQLRaceList and
tblRaceData.
confused.
 
Lets see if this explains it better.

I want to combine tblRaceData.P1Avg to SQLRaceList with the key field HN =
HN. P1Avg data does not exist for every record in SQLRaceList. My efforts to
query the database results is a loss of @8 % of the data from SQLRaceList,
where I am looking for 0 loss of data. I understand what you say regarding a
union query not being applicable, but perhaps you can offer guidance in how
to format a query to perserve all data from SQLRaceList while adding in the
other column.

Thank you
 
I replaced "LEFT JOIN" with "LEFT OUTER JOIN" and this appears to be my
answer. Thanks for your time and reply.
 
hi again,
you are most welcome
-----Original Message-----
I replaced "LEFT JOIN" with "LEFT OUTER JOIN" and this appears to be my
answer. Thanks for your time and reply.


.
 
Erik T said:
I replaced "LEFT JOIN" with "LEFT OUTER JOIN" and this appears to be
my answer. Thanks for your time and reply.

Although I can't figure out exactly what you were looking for in your
query, I am doubtful that just changing "LEFT JOIN" to "LEFT OUTER JOIN"
would make a difference, because they are semantically identical, at
least in Jet SQL. You may want to double-check your results.
 
Back
Top