CSharpBeginner
Programmer
I am new to SQL and I'm trying to write a storedprocedure that will search a customer table, get various customer info, then for each order associated with that customer, get the OrderType of each order.
Is there anyway to loop through the records in SQL since I don't have a pre-defined amount of records.
The key data model information looks like this:
Customer:
CustomerID (PK)
Order:
OrderID (PK)
CustomerID (FK)
OrderDetails:
OrderID (FK)
OrderType (FK)
OrderType:
OrderTypeID (PK)
OrderTypeName, etc.
I want to get the OrderTypeID for each order associated with this customer and I'm not certain how to do that.
Thanks for any help!!
Is there anyway to loop through the records in SQL since I don't have a pre-defined amount of records.
The key data model information looks like this:
Customer:
CustomerID (PK)
Order:
OrderID (PK)
CustomerID (FK)
OrderDetails:
OrderID (FK)
OrderType (FK)
OrderType:
OrderTypeID (PK)
OrderTypeName, etc.
I want to get the OrderTypeID for each order associated with this customer and I'm not certain how to do that.
Thanks for any help!!