Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Inner Joins NO FUN.
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

48 Posts

Posted - 06/21/2013 :  14:43:11  Show Profile  Reply with Quote
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

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:

SELECT column_name(s)
FROM table1
ON table1.column_name=table2.column_name;

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

Flowing Fount of Yak Knowledge

6065 Posts

Posted - 06/21/2013 :  14:51:58  Show Profile  Reply with Quote
Didn't school just let out? Is this summer school?

Be One with the Optimizer
Go to Top of Page

Very Important crosS Applying yaK Herder

52326 Posts

Posted - 06/22/2013 :  02:30:13  Show Profile  Reply with Quote
why not learn about joins first

SQL Server MVP
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000