Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF THEN ELSE statements in SQL

Status
Not open for further replies.

arobbo

IS-IT--Management
Feb 15, 2005
62
GB
hi the senario is such ,

some of our suppliers form part of groups and when calculating the total spend with each manufacturer i need to sum the invoice amounts based on a man_Code for a given time period. Now if i want to add a second table named associate suppliers which has the man_Code i can have many man_Code for one manufacturer (the other confusing thing is most people then call the supplier by one name so it only really needs one record but a record that can have many associated suppliers) basically in my calculations for all manufacturers who have corresponding records in the associated suppliers table do a sum of the spend for all manufacturers code (i can get this to work) but for all manufacturers who have NO corresponding records use the man_Code which is part of the manufacturers table....

hope that makes some sense
 
I suggest that you always put a record on the associates table - and just use the same name/code as the manufacturer if it is the only one.
 
yeah i think that will be the best way,

was trying to avoid it as theres 900 suppliers , but currently we're only working out our calculations one at a time when we add new agreements to the system.

thanks for your reply
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top