January 29, 2013 at 9:39 am
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.
January 29, 2013 at 10:29 am
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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
January 29, 2013 at 11:41 am
I wanna display the names of the customers along with the product names that they have purchased !!
January 29, 2013 at 12:20 pm
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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
January 29, 2013 at 12:25 pm
that's my question??? i don't know which ones can do the join ?
January 29, 2013 at 12:36 pm
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 Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
January 31, 2013 at 6:20 am
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[/url]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 RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply