Hi,
Up until now, I have never needed to extract data from 2 tables into a recorset and present the data in a controlled manner. I have use the site search facility but the only examples I have seen use left join etc. which I can't get my head around. Please could any one help or point me to a topic which explicitly covers this in a beginners manner?
The 2 table I have are as below.
Table:
products
product_ID
product_name
product_catagory_ID
product_etc.....
Table:
cart
cart_ID
order_ID
product_ID
etc....
What I would like to be able to do would be to get all the records from
cart where
cart.order_ID = (VALUE held in SESSION object) and pull the product name from products (products.product_name) from products for each
cart.product_ID in cart and display correct product name for each product in the cart with the other fields in the cart table.
So far my SQL statement is as follows but I don't know how to make it grab the name from products, or how to display it corectly after.
'## Select from data base record to show
strSQL = "SELECT cart.cart_ID, cart.order_ID, "
strSQL = strSQL & "cart.product_ID, cart.product_width, "
strSQL = strSQL & "cart.product_length, cart.unit_price, "
strSQL = strSQL & "cart.quantity, cart.line_total "
strSQL = strSQL & "FROM cart, products "
strSQL = strSQL & "WHERE ((cart.order_ID) = " & Session("order_ID") & " )"
strSQL = strSQL & ";"
I assume I need to do something along the lines of
'## Select from data base record to show
strSQL = "SELECT cart.cart_ID, cart.order_ID, "
strSQL = strSQL & "cart.product_ID, cart.product_width, "
strSQL = strSQL & "cart.product_length, cart.unit_price, "
strSQL = strSQL & "cart.quantity, cart.line_total, "
strSQL = strSQL & "products.product_ID, products.product_name "
strSQL = strSQL & "FROM cart, products "
strSQL = strSQL & "WHERE ((cart.order_ID) = " & Session("order_ID") & " ) AND products.product_ID = cart.product_ID"
strSQL = strSQL & ";"
Is this possible and can anybody suggest a method to do it?
Any help appreciated.
