SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

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

jrobin747
Starting Member

USA
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
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:

SELECT column_name(s)
FROM table1
INNER JOIN table2
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

TG
Flowing Fount of Yak Knowledge

USA
6062 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
TG
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

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

http://www.w3schools.com/sql/sql_join.asp

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New 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.09 seconds. Powered By: Snitz Forums 2000