Federated QueriesSelectA.*, B.adress, B.name fromA, bwhereA.sbno=B.cdidOrder byA.sbno, A.stimeSelect a.a_id, A.a_name, b.b_name from a A, b a where a.b_id = b.b_id // Union query
Insert intoTable1 (XX,YY,ZZ)SelectXx,yy,zz fromtable2;
SelectAxx asID, att asName fromtb1UnionSelectBxx asID, BTT asName fromTB2integrate fields from two tables with associated dataUpdateTableA asTA, TableB asTbSETTa.field1=Tb.field1WHERETa.id=tb.ta_id//Classic case (new user) a recordset obtained from Table A, as follows:1 -- One-13 -- One-28 -- One-5(old user) the recordset obtained through Table B, as follows:5 -- One-13 -- One-2I want to combine the two result sets into a single result set. The results displayed are as follows: Date new user old user -- One-1 1 5 -- One-2 3 3 -- One-5 8 0SelectA.col2, a.ID, Ifnull (b.ID,0) fromNewUser A Left JoinOlduser b onA.col2=b.col2;http://Www.cnblogs.com/Junezhang/Archive/ ./ ,/ -/1809306. html
MySQL Query Advanced usage