Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 2012
»
SQL Server 2012 - T-SQL
»
How to find the tables to join ?
How to find the tables to join ?
Rate Topic
Display Mode
Topic Options
Author
Message
salmita
salmita
Posted Tuesday, January 29, 2013 9:39 AM
Grasshopper
Group: General Forum Members
Last Login: Thursday, May 16, 2013 6:27 AM
Points: 16,
Visits: 39
Hello,
I am beginner in T-SQL.
I need to find the tables to the join between the table "Product" table and the "Customer" of the database AdventureWorks2012.
Any idea ?
Thank you.
Post #1413151
Sean Lange
Sean Lange
Posted Tuesday, January 29, 2013 10:29 AM
SSCrazy Eights
Group: General Forum Members
Last Login: 2 days ago @ 8:46 AM
Points: 8,547,
Visits: 8,204
salmita (1/29/2013)
Hello,
I am beginner in T-SQL.
I need to find the tables to the join between the table "Product" table and the "Customer" of the database AdventureWorks2012.
Any idea ?
Thank you.
Customers have no direct tie to Products. Are you wanting to maybe see the Products that a customer has ordered?
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1413184
salmita
salmita
Posted Tuesday, January 29, 2013 11:41 AM
Grasshopper
Group: General Forum Members
Last Login: Thursday, May 16, 2013 6:27 AM
Points: 16,
Visits: 39
I wanna display the names of the customers along with the product names that they have purchased !!
Post #1413219
Sean Lange
Sean Lange
Posted Tuesday, January 29, 2013 12:20 PM
SSCrazy Eights
Group: General Forum Members
Last Login: 2 days ago @ 8:46 AM
Points: 8,547,
Visits: 8,204
salmita (1/29/2013)
I wanna display the names of the customers along with the product names that they have purchased !!
So what table(s) do you think you might need for this?
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1413241
salmita
salmita
Posted Tuesday, January 29, 2013 12:25 PM
Grasshopper
Group: General Forum Members
Last Login: Thursday, May 16, 2013 6:27 AM
Points: 16,
Visits: 39
that's my question??? i don't know which ones can do the join ?
Post #1413247
Sean Lange
Sean Lange
Posted Tuesday, January 29, 2013 12:36 PM
SSCrazy Eights
Group: General Forum Members
Last Login: 2 days ago @ 8:46 AM
Points: 8,547,
Visits: 8,204
salmita (1/29/2013)
that's my question??? i don't know which ones can do the join ?
Well think about what you are asking. You are starting with knowing that you need customer and product information. You have that part down but think about what gets you from one to the other. What happens when a customer purchases something?
_______________________________________________________________
Need help? Help us help you.
Read the article at
http://www.sqlservercentral.com/articles/Best+Practices/61537/
for best practices on asking questions.
Need to split a string? Try Jeff Moden's
splitter
.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Post #1413256
Grant Fritchey
Grant Fritchey
Posted Thursday, January 31, 2013 6:20 AM
SSChampion
Group: General Forum Members
Last Login: Today @ 12:19 PM
Points: 13,371,
Visits: 25,144
If you really don't know the structure, then you need to hope that all the tables have foreign keys. You can look at the dependencies of one of the tables, say Products, to see which tables are related to it. Then you can walk the chain to figure out how to connect the tables you want.
Here's a great article from SQL Tip
s that shows a ton of ways to get this done.
----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of:
SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans
Product Evangelist for
Red Gate Software
Post #1414068
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.