Re: SQL sum

2017-04-21 Thread Gérard LOCHON
Le 21/04/2017 à 16:46, mbsoftwaresoluti...@mbsoftwaresolutions.com a écrit : On 2017-04-20 09:43, Jean MAURICE wrote: True tip, Jean is right. it's always a bad solution trying to get a minus backtime profit while not having a development analysis cursum.

Re: SQL sum

2017-04-21 Thread mbsoftwaresolutions
On 2017-04-20 09:43, Jean MAURICE wrote: BIG ERROR ! you MUST NOT have m as local alias. Choose another letter !! The Foxil That's another reason why I never use single-letter aliases. Learned that tip from Ed Leafe last century, as I recall, when I was first working in VFP5/6. I

RE: SQL sum

2017-04-20 Thread Tom Dawson
...@leafe.com] On Behalf Of Ted Roche Sent: 20 April 2017 15:02 To: profoxt...@leafe.com Subject: Re: SQL sum On Thu, Apr 20, 2017 at 8:38 AM, Tom Dawson <tdaw...@flexipol.co.uk> wrote: > Hi All > > I have a stock table which records the locations and quantities of various > items. The l

Re: SQL sum

2017-04-20 Thread Ted Roche
On Thu, Apr 20, 2017 at 8:38 AM, Tom Dawson wrote: > Hi All > > I have a stock table which records the locations and quantities of various > items. The layout of the table is like so: Tom: The problem with keeping a total in each row of the tables is that each record

Re: SQL sum

2017-04-20 Thread Jean MAURICE
BIG ERROR ! you MUST NOT have m as local alias. Choose another letter !! The Foxil ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox OT-free version of this list:

Re: SQL sum

2017-04-20 Thread Jean MAURICE
Hi Tom, what do you want to have as a result if your datas are 1 A 10 1 B 20 1 A 30 If you want 1 A 40 1 B 20 you can write SELECT stock_id, location, SUM(quantity) as mysum FROM mytable GROUP BY stock_id, location INTO but in this case (and except with VFP) you can't have a

Re: SQL sum

2017-04-20 Thread Peter Cushing
Hi Tom, Not sure if you are mixing up different tables here. In most of the stock systems I have seen you have: Stock header file. [stock id] [quantity] (in stock, allocated, on PO etc) This total could be say 100 in 4 locations, so 4 records in location file. then you have a stock

Re: SQL sum

2017-04-20 Thread Laurie Alvey
Are you grouping by stock_id AND location? Laurie On 20 April 2017 at 13:38, Tom Dawson wrote: > Hi All > > I have a stock table which records the locations and quantities of various > items. The layout of the table is like so: > > |stock id| |location| |quantity| > >

SQL sum

2017-04-20 Thread Tom Dawson
Hi All I have a stock table which records the locations and quantities of various items. The layout of the table is like so: |stock id| |location| |quantity| I want to be able to add a total field into the table which is a total of each unique stock id. To do this I tried to use a

SQL: SUM + GROUP BY ???

2007-03-09 Thread Ailsom F. Heringer (Osklen)
Foxers I have a table like below: ShopNO TicketNO ItemNOTicketTotal ItemTotal 01 00101 100.5025.50 01 00102 100.5075.00 02