News

Read this SQL tutorial to learn when to use SELECT, JOIN, subselects and UNION to access multiple tables with a single statement.
If your business uses relational databases to store data, it helps to use the SQL SELECT command with the INTO clause to create new tables from query results. This method isn't ANSI-standard SQL, but ...
You can use SQL to create, modify, search, and display database information. Dynamic SQL lets you create a query string based off of user input. SQL Server allows you to create dynamic SQL statements.
I don't know how deep your trees go, but mine's basically building the ancestor set for the entire table on each query. As much as I don't like imperative type code in my SQL, yours seems fine to me.