Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jrobin747
Starting Member
48 Posts |
Posted - 2013-06-21 : 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) ONHere is my scenarioTask Purpose: to list the history of a given ticket. The history will involve what permission queue it moves to and what path it followedWrite 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:SELECT column_name(s)FROM table1INNER JOIN table2ON table1.column_name=table2.column_name;AND NOT USE WHERE as some examples use WHERE like thisSELECT 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 |
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2013-06-21 : 14:51:58
|
Didn't school just let out? Is this summer school?Be One with the OptimizerTG |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|