• If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Datasource returns Compound/union statement columns must all have the same identifier

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Datasource returns Compound/union statement columns must all have the same identifier

    i'm running the following statement, which is running perfect in Dbeaver and within nitro app, also show correctly the fields to be selected , however when clicking 'next' in the to have the preview it returns me the error:

    can you please advise me how this can be solved

    PHP Code:
    SELECT ncctypr, nccdeel, NHCDIMX, ncnzend, NHQZEND,NHUTOTK,NHDFAKT,NHDMAAN,NHNYEAR,NHNFPER,NHNFYEAr,NCNKLNT,NCNARTK,NCCTRNC,NCCTRKP,NCNBTGB,NCNBTGT,NCNBTGG,NCNBTGN, ncutotk, pgxbtgn, pgqbtga, pgustuk FROM QGRON
    WHERE ncnzend
    =248333
    UNION
    SELECT ncctypr
    , nccdeel, NHCDIMX, ncnzend, NHQZEND,NHUTOTK,NHDFAKT,NHDMAAN,NHNYEAR,NHNFPER,NHNFYEAr,NCNKLNT,NCNARTK,NCCTRNC,NCCTRKP,NCNBTGB,NCNBTGT,NCNBTGG,NCNBTGN, ncutotk, pixbtgn, piqbtga, piustuk  FROM QINS
    WHERE ncnzend
    =248333
    UNION
    SELECT ncctypr
    , nccdeel, NHCDIMX, ncnzend, NHQZEND,NHUTOTK,NHDFAKT,NHDMAAN,NHNYEAR,NHNFPER,NHNFYEAr,NCNKLNT,NCNARTK,NCCTRNC,NCCTRKP,NCNBTGB,NCNBTGT,NCNBTGG,NCNBTGN, ncutotk, Pxxbtgn, pxqbtga, pxutotk  FROM QGRONASSY
    WHERE ncnzend
    =248333
    UNION
    SELECT ncctypr
    , nccdeel, NHCDIMX, ncnzend, NHQZEND,NHUTOTK,NHDFAKT,NHDMAAN,NHNYEAR,NHNFPER,NHNFYEAr,NCNKLNT,NCNARTK,NCCTRNC,NCCTRKP,NCNBTGB,NCNBTGT,NCNBTGG,NCNBTGN, ncutotk, phxbtgn, 0, phutotk  FROM QNABEW
    WHERE ncnzend
    =248333
    UNION
    SELECT ncctypr
    , nccdeel, NHCDIMX, ncnzend, NHQZEND,NHUTOTK,NHDFAKT,NHDMAAN,NHNYEAR,NHNFPER,NHNFYEAr,NCNKLNT,NCNARTK,NCCTRNC,NCCTRKP,NCNBTGB,NCNBTGT,NCNBTGG,NCNBTGN, ncutotk, ' ', pqpuitv, pqutotk  FROM QUITVAL
    WHERE ncnzend
    =248333
    ORDER BY ncnzend
    , ncnartk, ncctypr, ncnbtgb, ncnbtgt, ncnbtgg, ncnbtgn
    ? 

    image.png?


  • #2
    The columns must all have the same names. The last three columns use different names, so if you alias the last three columns in the 2nd through 5th SELECT statements to match the names from the first SELECT, you should be good to go.

    Example:
    Code:
    pixbtgn as pgxbtgn,
    piqbtga as pgqbtga,
    piustuk as pgustuk

    Comment

    Working...
    X