I need to write a select statement which gathers not only information from multiple tables, but information from within a certain table which matches data in other rows within that same table.
So while joins would work for the multiple table issue, as far as I am aware I cannot “join” column a and column b in the same table.
Here’s the detail
I have the following tables
CR, VM and Folder
I need to select the following:
ID and Name from CR
Folder Name
Folder name however is not in the folder table, to find it, I need to first take “ID” from CR and match it to “ObjectID” in VM – then the column “Location” in that row matches the ObjectID of another row in the VM table.
I need to then match ID in folder to that ObjectID and retrieve “Name” in the table “Folder” to retrieve the folder name”.
I don’t quite know where to start, should I use cursors for this?
It is possible to join a table against itself by aliasing one side of the join. This may be enough to get you started. Otherwise we would need to see some sample data.