Hi
I have following SQL Queries. Is there a way to to write a single query instead somehow instead?
-Get OrderID from this query
SELECT OrderID FROM Orders WHERE CustomerID='" + reader.Item("Cu stomerID")
-Using OrderID, get ProductID
"SELECT ProductID FROM OrderDetails WHERE OrderID=" + readerp.Item("O rderID")
-Using ProductID, get Products
SELECT ProductName FROM Products WHERE ProductID=" + reader1.Item("P roductID")
My question is instead of quering three times, can i write a single SQL statemnt to get the final result - (ProductName)
Thanks
Qi
I have following SQL Queries. Is there a way to to write a single query instead somehow instead?
-Get OrderID from this query
SELECT OrderID FROM Orders WHERE CustomerID='" + reader.Item("Cu stomerID")
-Using OrderID, get ProductID
"SELECT ProductID FROM OrderDetails WHERE OrderID=" + readerp.Item("O rderID")
-Using ProductID, get Products
SELECT ProductName FROM Products WHERE ProductID=" + reader1.Item("P roductID")
My question is instead of quering three times, can i write a single SQL statemnt to get the final result - (ProductName)
Thanks
Qi
Comment