Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2011
    Posts
    6

    Unanswered: Need to have headers from one table and the data

    I am trying to populate a query by using headers from one table (that has no data) and a query that has the data.
    For example the header table contains the Title "Manufacturer Name" but I need that data pulled from another query that contains the data I want filled in for that column.
    Any suggestions?

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Try something like:
    Code:
    SELECT Table_Headers.RowID, 
           Table_Headers.FirstColumn, 
           Table_Headers.SecondColumn, 
           Table_Headers.ThirdColumn
      FROM Table_Headers
    UNION
    SELECT Table_Data.SysCounter, 
           Table_Data.Column1, 
           Table_Data.Column2, 
           Table_Data.Column3
      FROM Table_Data
    The name of the columns in the second table does not matter, only the number of columns (it must be the same in both SELECT statements) and, to a certain extend, the data type: implicit conversions are possible but it's better not to rely too heavily on them.
    Have a nice day!

Tags for this Thread

Posting Permissions

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