Combine the Table and Insert a value

R

Ranjith Kurian

I tried the below query using 23 tables, i got a error "Duplicate output
alias File_Date, could you please advise me.

SELECT Mon.[Customer Name (DFF)], Mon.Amount, "weekMon" AS File_Date
FROM Mon
Union All
SELECT Tue.[Customer Name (DFF)], Tue.Amount, "weekTue" AS File_Date
FROM Tue;
 
R

RonaldoOneNil

Your field names are derived from your first statement in a union query so
you do not need to specify it in the statements after.

SELECT Mon.[Customer Name (DFF)], Mon.Amount, "weekMon" AS File_Date
FROM Mon;
Union All SELECT Tue.[Customer Name (DFF)], Tue.Amount, "weekTue" FROM Tue;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top