Click here to Skip to main content
15,894,955 members
Home / Discussions / Database
   

Database

 
GeneralRe: SQL DATETIME ..... Help!!!!! Pin
BooleanTrue14-Feb-07 2:54
professionalBooleanTrue14-Feb-07 2:54 
AnswerRe: SQL DATETIME ..... Help!!!!! Pin
Harini N K21-Feb-07 22:13
Harini N K21-Feb-07 22:13 
QuestionPlease review and suggest Pin
logicon14-Feb-07 0:52
logicon14-Feb-07 0:52 
AnswerRe: Please review and suggest Pin
Pete O'Hanlon14-Feb-07 1:35
mvePete O'Hanlon14-Feb-07 1:35 
GeneralRe: Please review and suggest Pin
logicon14-Feb-07 1:40
logicon14-Feb-07 1:40 
GeneralRe: Please review and suggest Pin
Pete O'Hanlon14-Feb-07 1:49
mvePete O'Hanlon14-Feb-07 1:49 
GeneralRe: Please review and suggest Pin
logicon14-Feb-07 2:24
logicon14-Feb-07 2:24 
GeneralRe: Please review and suggest Pin
andyharman14-Feb-07 2:39
professionalandyharman14-Feb-07 2:39 
The ProductPriceHistory may need to be normalised so that it doesn't have a different price for each day of the week). It looks like you would need some ugly case statements to find out the price for any specific date.

You might want to set up a Query like:
SELECT A.* FROM ProductPriceHistory A
INNER JOIN (
  SELECT C.PCode, Min(C.EffectiveDate) AS EffectiveDate
  FROM ProductPriceHistory C
  WHERE C.EffectiveDate < MyPriceDate
  GROUP BY C.PCode
) B
ON B.PCode = A.Pcode
AND B.EffectiveDate = A.EffectiveDate
ORDER BY A.PCODE ;
to allow you to easily find the effective price at any point in time (assuming that you do normalise theis table). This will ask for the appropriate PriceDate to be specified as a parameter.

I would recommend changing the column names of "Date" and "Value" to names that are not reserved words.

I would denormalise slightly and store the current balance on the Vendor table. This information is likely to be used a lot (so performance may be an issue), and means that you would never be able to cleardown your sales history (which means you may have scalability issues). If you are only going to have a few thousand records then this may not be a problem(and you could create another Query that tells you the current balance for each vendor).

As Pete indicated, you might want to remove the address details from the Vendor table - and instead indicate which office is the main address. You might consider linking from Sale to Branch (instead of Vendor). That would allow you to tell which branch the goods should be shipped-to and potentially provide useful management reporting.

Hope that helps.
Andy
GeneralRe: Please review and suggest Pin
logicon14-Feb-07 2:58
logicon14-Feb-07 2:58 
Questioncase sensitive search Pin
Rocky#14-Feb-07 0:02
Rocky#14-Feb-07 0:02 
AnswerRe: case sensitive search Pin
andyharman14-Feb-07 0:09
professionalandyharman14-Feb-07 0:09 
GeneralRe: case sensitive search Pin
Rocky#14-Feb-07 17:40
Rocky#14-Feb-07 17:40 
AnswerRe: case sensitive search Pin
Pete O'Hanlon14-Feb-07 1:25
mvePete O'Hanlon14-Feb-07 1:25 
QuestionDatabase SqlServer2000 on Server Pin
sanaziuse13-Feb-07 22:34
sanaziuse13-Feb-07 22:34 
AnswerRe: Database SqlServer2000 on Server Pin
Pete O'Hanlon13-Feb-07 23:24
mvePete O'Hanlon13-Feb-07 23:24 
GeneralRe: Database SqlServer2000 on Server Pin
sanaziuse13-Feb-07 23:44
sanaziuse13-Feb-07 23:44 
GeneralRe: Database SqlServer2000 on Server Pin
Pete O'Hanlon13-Feb-07 23:46
mvePete O'Hanlon13-Feb-07 23:46 
QuestionQuery regarding view Pin
Member 309559313-Feb-07 21:40
Member 309559313-Feb-07 21:40 
AnswerRe: Query regarding view Pin
andyharman13-Feb-07 22:58
professionalandyharman13-Feb-07 22:58 
QuestionSQL Server 2005 Mixed Mode login Change Pin
JacquesDP13-Feb-07 20:47
JacquesDP13-Feb-07 20:47 
QuestionHelp on a query Pin
logicon13-Feb-07 20:21
logicon13-Feb-07 20:21 
AnswerRe: Help on a query Pin
andyharman13-Feb-07 22:50
professionalandyharman13-Feb-07 22:50 
GeneralRe: Help on a query Pin
logicon13-Feb-07 23:03
logicon13-Feb-07 23:03 
GeneralRe: Help on a query Pin
Pete O'Hanlon13-Feb-07 23:25
mvePete O'Hanlon13-Feb-07 23:25 
QuestionHow can I use multiple queries Pin
N a v a n e e t h13-Feb-07 20:15
N a v a n e e t h13-Feb-07 20:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.