SQL2008 T-SQL Note
1. INNER JOIN
select a.* ,b.AGAServicePort
from MC_Entity a
INNER JOIN AGA_Status b
ON b.AGAServicePort = a.MC_ServicePort
where a.MC_ServicePort <> '9660'
2. INSERT INTO
2.1 不带列名插进数据
INSERT INTO TestTable
VALUES("Test1","2005-06-12") // TestTable 第一列为ID,SQL自动从第二列开始INSERT DATA
2.2 有列名
INSERT INTO TestTable (Col5,Col3,Col4)
VALUES("5","4","3") //数据插进与Table本身列顺序无关,只按照所选列顺序为准。
2.3 插进查询返回
INSERT TOP 3 INTO Table ( ColOne,ColTwo)
select TOP 10 B.ColOne , B.ColTwo
From Two B
3. UPDATE
3.1
update top 10 AGA_Status set AGAUpdateDate = a.MC_ServicePort
FROM MC_Entity a
INNER JOIN AGA_Status b
ON b.AGAServicePort = a.MC_ServicePort
FROM MC_Entity a
INNER JOIN AGA_Status b
ON b.AGAServicePort = a.MC_ServicePort
- Make people around you successful is the biggest contribution to ourselves. -