sql >> Database teknologi >  >> RDS >> Mysql

mysql union forskelligt antal kolonner

Du vil gerne vælge kolonner som NULL at optage den tomme plads i visse tabeller.

Tabel A:(id, kolonne1)

Tabel B:(id, kolonne1, kolonne2)

Select id, column1, null as column2 from tableA
UNION
Select id, column1, column2 from tableB


  1. 5 grunde til at vælge Arkware

  2. Opret geografipolylinje fra punkter i T-SQL

  3. Alias ​​for GROUP BY-klausul?

  4. Mysql Real Escape String PHP-funktion Tilføjer \ til My Field Entry