1 SELECT C1.CustID AS C1CustID,C1.CustName AS C1CustName,C1.CustCompany AS C1CustCompany,C2.CustID,C2.CustName,C2.CustCompany 2 FROM Customers AS C1 3 JOIN Customers AS C2 4 ON C1.CustID=C2.CustID
½á¹û£º
6.2 ʾÀý½á¹û·ÖÎö
ÈçÉÏÀý×ÓΪ×ÔÁ¬½ÓÔÚÄÚÁ¬½ÓÖеÄÔËÓã¬ÔÚÆäËûÁ¬½ÓÖеÄÔËÓþͲ»¾ÙÀý×ÓÁË£¬±È½Ï¼òµ¥¡£
6.3 С½á
a.×ÔÁ¬½ÓΪµ¥¸ö±íÈ¡²»Í¬µÄ±ðÃû£¬Í¨¹ý±ðÃûÀ´Á¬½Ó£» b.×ÔÁ¬½Ó¿ÉÒÔÓÃÓÚÆäËüÁ¬½Ó£» b.×ÔÁ¬½Ó¿ÉÒÔ¿´×÷½»²æÁ¬½Ó¡¢ÄÚÁ¬½Ó¡¢ÍâÁ¬½ÓµÈÁ¬½ÓµÄÒ»¸öÌØÀý;
7 ÎÊÌâ´ð°¸
Q1£ºKEY
CREATE TABLE Digits ( digit int not null primary key ) --Initial testing data for Digits INSERT INTO Digits VALUES(0),(1),(2),(3),(4),(5),(6),(7),(8),(9) --Query SELECT D3.digit*100+D2.digit*10+D1.digit+1 AS n FROM Digits AS D1 CROSS JOIN Digits AS D2 CROSS JOIN Digits AS D3 ORDER BY n
8 ²Î¿¼ÎÄÏ×
¡¾01¡¿Microsoft SqlServer 2008¼¼ÊõÄÚÄ»:T-SQL ÓïÑÔ»ù´¡
¡¾02¡¿Microsoft SqlServer 2008¼¼ÊõÄÚÄ»:T-SQL ²éѯ
9 °æȨ
¡¡