By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,587 Members | 1,047 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,587 IT Pros & Developers. It's quick & easy.

How do I build this sql statement?

100+
P: 110
I need to populate a table with customer and produdct number so that a new table will have products A-C for each customer 1-9

so
customer product
1 A
1 B
1 C
2 A
2 B
2 C

and so on...i think this can be doine with sql statements, but i have no idea how...any help is highly appreciated...thanks
Mar 21 '07 #1
Share this Question
Share on Google+
3 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
I need to populate a table with customer and produdct number so that a new table will have products A-C for each customer 1-9

so
customer product
1 A
1 B
1 C
2 A
2 B
2 C

and so on...i think this can be doine with sql statements, but i have no idea how...any help is highly appreciated...thanks
Try a full outer join as follows:
Expand|Select|Wrap|Line Numbers
  1. SELECT customerID, productID
  2. FROM customers, products
  3. ORDER BY customerID;
  4.  
Mary
Mar 21 '07 #2

100+
P: 110
oh wow, talk about forgetting the basics...thanks lol
Mar 21 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
oh wow, talk about forgetting the basics...thanks lol
No problem ;)
Mar 21 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.