Combining 2 tablles into 1 in access (only)

Results 1 to 2 of 2

Thread: Combining 2 tablles into 1 in access (only)

  1. #1
    Join Date
    Dec 1969

    Default Combining 2 tablles into 1 in access (only)

    Hey all, Im using access to create a small application. (no web connection)<BR><BR>I have 2 tables that are very similar (2 fields are different)<BR>Table 1 is called clients. Table 2 is called prospects.<BR>What I need to be able to do is combine both of these tables together where I then can access the data by a form or report.<BR><BR>I dont want to combine them so all the data is seen together on the screen from both tables but rather, combine them so that when I am crusing through the records via a form it seamlessly gets the records from both tables.<BR><BR>Any help is much appreciated.

  2. #2
    Join Date
    Dec 1969

    Default Use a UNION

    SELECT fld1, fld2, fld3 FROM Clients WHERE xxx=yyy<BR>UNION<BR>SELECT fldA, fldB, fldC FROM Prospects WHERE zzz=www<BR>ORDER BY fld1<BR><BR>The data types in the two SELECTs must match, in order, for the entire list [though you could add NULLs to the shorter list if they aren&#039;t the same length]. "Match" is a little flexible: text fields of any size match each other. Number fields of most any kind match. DateTime must match up with DateTime, though. <BR><BR>The names you use in the ORDER BY come *ONLY* from the FIRST SELECT. The names in the second SELECT don&#039;t matter at all, only the data types do.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts