Microsoft
Software
Hardware
Network
Question : explain T-SQL query to me
Can somebody explain this SQL query to me? what is it doing?
DECLARE @CollectionID int
SELECT @CollectionID= C2.CollectionID
FROM Collections C1
INNER JOIN Collections C2 on C1.CollectionID = C2.ParentID
WHERE C1.Title= '09-0274'
--AND C1.CompanyID= 1 and C2.Title LIKE 'Vendor-' + '240635'
AND C1.CompanyID= 1 and C2.Title LIKE '%240634%'
Answer : explain T-SQL query to me
This type of JOIN is called 'Self Join' - Joining a table with itself.
http://msdn.microsoft.com/
en-us/libr
ary/ms1774
90.aspx
In your case, 'ParentID' column is JOINed to 'CollectionID' column of the same table.
Raj
Random Solutions
What is the extension to bring in a 2007 Excel xlsm workbook into Access 2007?
How do I add rows to a datagridview based upon a For Each statement in VS2008?
Exchange 2007 mail relay
Samba share on Windows 2003
Exchange 2010 resource mailbox for meeting room
CISCO IP PHONES POWER CONSUMPTION THROUGH CAT5
T SQL Query and Dates
Cisco ASA 8.3 RDP Configuration Syntax
kvm cables for dell poweredge server
Exchange 2010 Antivirus Options