Question about using UNION

Results 1 to 2 of 2

Thread: Question about using UNION

  1. #1
    Korry Guest

    Default Question about using UNION

    First off thanks for writing the book. (Matt & James) It&#039;s great and I&#039;m getting a promotion at work because of it. Onto the question.... <BR>I have an Access db with a lot of tables, one for each letter.(a-z) I&#039;m trying to use UNION to query all the tables, which works great up to a point. If I get over a certain amount of tables it gives this error... <BR><BR>"[Microsoft][ODBC Microsoft Access Driver] Not a valid alias name. " <BR><BR>The error goes away when I take out a couple lines, and it doesn&#039;t matter which lines I take out. Is there a limit to the number of tables you can query this way? Is there a better way to do this? <BR><BR>Here is the code I&#039;m using.. <BR>"UNION SELECT * FROM [a]"&_ <BR>"UNION SELECT * FROM [b]"&_ <BR>"UNION SELECT * FROM [c]"&_ <BR>"UNION SELECT * FROM [d]"&_ <BR><BR>Etc. Thanks for the help. <BR><BR>Korry.

  2. #2
    Join Date
    Dec 1969

    Default RE: Question about using UNION

    strSQL=" SELECT * FROM [a]"& _ <BR>" UNION SELECT * FROM [b]"& _ <BR>" UNION SELECT * FROM [c]"& _ <BR>" UNION SELECT * FROM [d]"<BR>&#039;check how your query looks like..<BR>Response.Write (strSQL)<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