Result from 2 tables with no link

  • You can get records if u have diff in No. of Fields / Diff in Data Type like this

    Table 1

    -------

    Field1      Integer

    Field2      Desc

    Field3      Date

    Table2

    -------

    Field1      Integer

    Field2      Desc

    Field4      Numeric(12,2)

    SELECT Field1, Field2, Field3, 0 AS Field4 From Table1

    UNION ALL

    SELECT Field1, Field2, NULL, Field4  FROM Table2

    This is just Example i don't know this will help u out as your purpose of getting data from Tables may be anything else

  • All valid but they are getting a bit "icky"   Two separate resultsets is the clearest way to do it, but depending on your client side library, etc (maybe going to a report engine - i cannot remember the details of this thread anymore!) the unions may be required, but usually as a fallback.

Viewing 2 posts - 16 through 16 (of 16 total)

You must be logged in to reply to this topic. Login to reply