@@identity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • siddu57
    New Member
    • Feb 2008
    • 5

    @@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
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Originally posted by siddu57
    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:

    Code:
    SELECT t1.orderid, t1.ofd, orderdate, customername, product_id, productname
    from table1 t1 inner join t2 on t1.orderid = t2.orderid and t1.ofd and t2.ofd

    -- CK

    Comment

    Working...