Greetings,
I have a table which contains product information called Products contains fields: ProductID, ProductName, and another table called UnitsInStores contains fields: StoreID, ProductID, UnitsNumber, UnitPrice
My first question is: Is it better design to put the UnitPrice field within the Products table or to put it within UnitsInStores table (As is happening already)
//-------------------------------------------------------------------------------------------------------------------
I have a table called CustomerNewPrices contains fields: ClientID, NewPrice, IssueDate in which I store product's new price for customers which given to the customer in a certain date
My question is: I wanna make a SQL Statement that when I issue a new invoice according to the invoice issue date and a specific customer too, before it returns me the unit price of the product it checks if there is a new price for that customer with a new price issue date equal to or greater than the invoice issue date. and if there are many price update for that customer for example that customer had a new price at 20/04/2013 and another new price at 25/04/2013 if I made the check as IssueDate >= @InvoiceIssueDate and @InvoiceIssueDate was 28/04/2013 it doesn't return me anything until the date within parameter was only equal to the dates in the table, however, I put the condition >=