472,111 Members | 1,923 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,111 software developers and data experts.

@@identity

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
1 1269
ck9663
2,878 Expert 2GB
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.

Similar topics

2 posts views Thread by Edward | last post: by
5 posts views Thread by DBA | last post: by
5 posts views Thread by grzes | last post: by
13 posts views Thread by PinkBishop | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.