UserID Manufactor Country Model Time to et Engine CC PriceS$
100001188587932 vsd dsv 3 Series 2012 2011 10000
100001188587932 fsd fs 3 Series 2012 2010 50000
100001188587932 BMW German 3 Series 2012 2012 0
100001188587932 BMW 3 Series 2012 2004 0
100001188587932 BMW German 3 Series 2012 2006 0其中Manufactor,Country和Model是一个table的.
而Time , Engine 和Price 又是另一个table的.
如何把他们合并在一起呢?
100001188587932 vsd dsv 3 Series 2012 2011 10000
100001188587932 fsd fs 3 Series 2012 2010 50000
100001188587932 BMW German 3 Series 2012 2012 0
100001188587932 BMW 3 Series 2012 2004 0
100001188587932 BMW German 3 Series 2012 2006 0其中Manufactor,Country和Model是一个table的.
而Time , Engine 和Price 又是另一个table的.
如何把他们合并在一起呢?
from table1
inner join table2 on table1.UserID = table2.UserID
--如果UserID关联
select UserID,Manufactor,Country, Time , Engine, Price
from tab1
inner join tab2 on tab1.UserID = tab2.UserID--如果没有关联select UserID,Manufactor,Country, Time , Engine, Price
from tab1
cross join tab2
--注意如果tab1\tab2数据量大,cross join
将以笛卡尔积的形式将表的所有记录一一连接,结果集数据量将会剧增
from table1 as t1
cross join table2 as t2