Posted - 06/21/2013 : 14:43:11
| I am new to sql. I am learning how to do inner joins. I have 3 table of which there are no columns in the tables that share the same name or id. All the examples I've seen show where table1 and table 2 may share user id or something like that.
I don't know when to use
INNER JOIN AS
INNER JOIN ON
INNER JOIN WITH (NOLOCK) ON
Here is my scenario
Task Purpose: to list the history of a given ticket. The history will involve what permission queue it moves to and what path it followed
Write a query to return:
The tickets Escalation date and time, who escalated it and what queue they escalated it from
You will use
dbo.DatalinkTicketEscalationHistory to get the LastUpdateOn and inner join this table to dbo.Users to get the FirstName and LastName of the user that escalated it.
You will need to get the GroupName as the QueName from dbo.TicketPermissionGroup. To do this, it will need to be inner joined to the dbo.DatalinkTicketEscalationHistory table by PermissionGroupID (to TicketPermissionGroupID)
You need to do all of this based on the TicketID (in the DatalinkTicketEscalationHistory table). So your WHERE should be based on a single Ticket ID (you can choose one for testing purposes)
I have no clue how to do this inner join. I was told to user INNER JOIN similar to this:
INNER JOIN table2
AND NOT USE WHERE as some examples use WHERE like this
SELECT lastname, firstname, tag, open_weekends
FROM drivers, vehicles, locations
WHERE drivers.location = vehicles.location
AND vehicles.location = locations.location
AND locations.open_weekends = 'Yes'
Thanks. This will be my first time doing a inner join