Re: [SQL] advice on how to store variable attributes

2011-10-22 Thread Linos
El 22/10/11 18:10, David Johnston escribió: > > > SELECT ... > FROM vendor_invoices > JOIN ( SELECT ... FROM eav WHERE category = '' ) icm USING ( invoice_id ) > > Add a sub-query join for each desired category. > > I agree HStore looks cleaner for the query example you give. One apparent > a

Re: [SQL] advice on how to store variable attributes

2011-10-22 Thread David Johnston
On Oct 22, 2011, at 11:39, Linos wrote: > El 22/10/11 14:53, David Johnston escribió: >> On Oct 22, 2011, at 6:41, Linos wrote: >> >>> Hi all, >>> i need a little of advice on what could be the best way to store this >>> information. >>> >>> We need to calculate the difference in costs for

Re: [SQL] advice on how to store variable attributes

2011-10-22 Thread Scott Swank
I would opt for a hybrid of 1 & 3. I imagine that many of your costs are the same month in, month out. Those I would put in specific columns, and then retrieve the varying columns from an EAV model. If you only run invoicing monthly then I'd be tempted to store this varying EAV structure in a seri

Re: [SQL] advice on how to store variable attributes

2011-10-22 Thread Pavel Stehule
> > Yeah, thanks for the advice David, if i understand you. this is (much better > explained) my option 3, i have used this format any times for configuration > tables with great success. > > I am not speaking about much data, maybe 200~300 invoices every month so this > should not be a problem in

Re: [SQL] advice on how to store variable attributes

2011-10-22 Thread Linos
El 22/10/11 14:53, David Johnston escribió: > On Oct 22, 2011, at 6:41, Linos wrote: > >> Hi all, >>i need a little of advice on what could be the best way to store this >> information. >> >> We need to calculate the difference in costs for our operations, we are >> already >> storing our v

Re: [SQL] advice on how to store variable attributes

2011-10-22 Thread Pavel Stehule
2011/10/22 David Johnston : > On Oct 22, 2011, at 10:07, Pavel Stehule wrote: >> 2011/10/22 David Johnston : >>> On Oct 22, 2011, at 6:41, Linos wrote: >>> Hi all,    i need a little of advice on what could be the best way to store this information. We need to calculate

Re: [SQL] advice on how to store variable attributes

2011-10-22 Thread Pavel Stehule
2011/10/22 David Johnston : > On Oct 22, 2011, at 6:41, Linos wrote: > >> Hi all, >>    i need a little of advice on what could be the best way to store this >> information. >> >> We need to calculate the difference in costs for our operations, we are >> already >> storing our vendor invoices in

Re: [SQL] advice on how to store variable attributes

2011-10-22 Thread David Johnston
On Oct 22, 2011, at 6:41, Linos wrote: > Hi all, >i need a little of advice on what could be the best way to store this > information. > > We need to calculate the difference in costs for our operations, we are > already > storing our vendor invoices in the database so calculate the moneta

[SQL] advice on how to store variable attributes

2011-10-22 Thread Linos
Hi all, i need a little of advice on what could be the best way to store this information. We need to calculate the difference in costs for our operations, we are already storing our vendor invoices in the database so calculate the monetary change it is a no-brainer but we need to store s