List:General Discussion« Previous MessageNext Message »
From:Dan Nelson Date:August 29 2002 3:28am
Subject:Re: Join with Union
View as plain text  
In the last episode (Aug 29), suresh said:
> I changed from mysql  3.23.49 -nt to 4.0.2 max to make use of union
> But one problem  when trying to join  tables is that UNION works only
> for SELECT queries with same number of coulmns. Is there any way to
> join 3 or more tables having different columns using UNION? I am
> writing my query during the runtime. Since the user can select any
> number of fileds from a particular table and also I am using LEFT
> JOIN, I can't make all the tables having same number of fields.

You can easily add dummuy colums to the queries that are missing

SELECT name, "N/A" from table1 
SELECT name, address from table2;

	Dan Nelson
Join with Unionsuresh29 Aug
  • Re: Join with UnionDan Nelson29 Aug
  • Re: Join with UnionPaul DuBois29 Aug
Re: Join with UnionDan Nelson29 Aug