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

@@identity

P: 5
I got two tables

one table has the fields ie table1

orderid ofd orderdate customername

where order id is autonumber

the other table2

orderid ofd product id productname


the problem here is that
if customer purchases 3 product at a time all the 3 products get the same ofd number ........and any 2 customers can have the same ofd number................ now i have to pull the order ID value from table 1 to table 2............ can somebody help with this i am the front end is asp.net amd the database is done on SQL server management studio
Feb 29 '08 #1
Share this Question
Share on Google+
1 Reply


ck9663
Expert 2.5K+
P: 2,878
I got two tables

one table has the fields ie table1

orderid ofd orderdate customername

where order id is autonumber

the other table2

orderid ofd product id productname


the problem here is that
if customer purchases 3 product at a time all the 3 products get the same ofd number ........and any 2 customers can have the same ofd number................ now i have to pull the order ID value from table 1 to table 2............ can somebody help with this i am the front end is asp.net amd the database is done on SQL server management studio

use the two fields as your join key.... something like:

Expand|Select|Wrap|Line Numbers
  1. SELECT t1.orderid, t1.ofd, orderdate, customername, product_id, productname
  2. from table1 t1 inner join t2 on t1.orderid = t2.orderid and t1.ofd and t2.ofd
  3.  

-- CK
Feb 29 '08 #2

Post your reply

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