Re: An SQL Select poser.

2012-01-31 Thread Alan Bourke
Thanks all will give them a try! -- Alan Bourke alanpbourke (at) fastmail (dot) fm ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/list

Re: An SQL Select poser.

2012-01-30 Thread Ricardo Araoz
El 30/01/12 18:10, Alan Bourke escribió: > > On Mon, Jan 30, 2012, at 04:29 PM, Paul Newton wrote: >> Perhaps he will let us know which approach >> he prefers :) >> >> > I just want a .t. or .f. if the rows that pertain to a particular > account/reference/date combination have a mixture of negativ

RE: An SQL Select poser.

2012-01-30 Thread Alan Bourke
On Mon, Jan 30, 2012, at 04:29 PM, Paul Newton wrote: > Perhaps he will let us know which approach > he prefers :) > > I just want a .t. or .f. if the rows that pertain to a particular account/reference/date combination have a mixture of negative and positive values. All negative or all positi

Re: RE: An SQL Select poser.

2012-01-30 Thread AndyD
.@leafe.com [mailto:profoxtech-boun...@leafe.com] On > Behalf Of Jean MAURICE > Sent: 30 January 2012 15:22 > To:profoxt...@leafe.com > Subject: Re: An SQL Select poser. ___ Post Messages to: ProFox@leafe.com Subscription Maintenance: http://l

Re: An SQL Select poser.

2012-01-30 Thread AndyD
CREATE TABLE actrans FREE (account c5, reference c4, transdate D, Value n4.2) CREATE TABLE actrans FREE (account c(5), reference c(4), transdate D, Value n(4.2)) INSERT INTO actrans VALUES ('AB001', 'Ref1', DATE(2011,01.30), 39.99) INSERT INTO actrans VALUES ('AB001', 'Ref1', DATE(2011,01,30), 3

RE: An SQL Select poser.

2012-01-30 Thread Paul Newton
approach he prefers :) Paul -Original Message- From: profoxtech-boun...@leafe.com [mailto:profoxtech-boun...@leafe.com] On Behalf Of Jean MAURICE Sent: 30 January 2012 15:22 To: profoxt...@leafe.com Subject: Re: An SQL Select poser. Paul, it seems very clever and a lot more simple than my

Re: An SQL Select poser.

2012-01-30 Thread Jean MAURICE
Paul, it seems very clever and a lot more simple than my solution. Best regards The Foxil Le 30/01/2012 15:21, Paul Newton a écrit : > Alan > > How about Selecting Sum(Value) As n1, Sum(Abs(Value)) As n2 Having Abs(n1) # > Abs(n2) > > Paul Newton >

Re: An SQL Select poser.

2012-01-30 Thread Alan Bourke
On Mon, Jan 30, 2012, at 08:35 AM, Stephen Russell wrote: > > > > > > Account | Reference | Date       |    Value > > +---++-- > > AB001   | Ref 1     | 30/01/2011 |    39.99 > > AB001   | Ref 1     | 30/01/2011 |   150.90 > > AB001   | Ref 1     | 30/01/2011 |

Re: An SQL Select poser.

2012-01-30 Thread Stephen Russell
On Mon, Jan 30, 2012 at 7:42 AM, Alan Bourke wrote: > > I have a DBF with invoice and credit note information. There can be one > or more records per invoice/c.note, the uniqueness is account code + > reference + date. So all rows with the same combination of those three > fields can be taken to e

RE: An SQL Select poser.

2012-01-30 Thread Paul Newton
Alan How about Selecting Sum(Value) As n1, Sum(Abs(Value)) As n2 Having Abs(n1) # Abs(n2) Paul Newton -Original Message- From: profoxtech-boun...@leafe.com [mailto:profoxtech-boun...@leafe.com] On Behalf Of Alan Bourke Sent: 30 January 2012 13:42 To: profoxt...@leafe.com Subject: An SQ

Re: An SQL Select poser.

2012-01-30 Thread Jean MAURICE
You can try something like SELECT aa.account, aa.reference, aa.date, aa.value ; FROM yourtable aa ; WHERE aa.value > 0 AND ; aa.account+aa.reference+DTOS(aa.date)IN ; SELECT ab.account+ab.reference+DTOS(ab.date) ; FROM yourtable ab WHERE ab.value <0) ; INTO CURSOR myresult ; UNION ; SELECT

Re: An SQL Select poser.

2012-01-30 Thread Richard Quilhot
You need to add to the test conditions a calculation of weither the value field is positive or negative; or create a new field in the source table with a positive / negative indicator and add that field to the test conditions Rick Q On Mon, Jan 30, 2012 at 8:42 AM, Alan Bourke wrote: > > I hav