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 negative and
> positive values. All negative or all positive is fine!
Untested :
select Account, Reference, Date
, (!IsNull(Pos.Account) and !IsNull(Neg.Account)) as 'IsMixture'
from TheTable TT
left join ( select Distinct Account, Reference, Date
from TheTable
where Value > 0
) Pos
on Pos.Account = TT.Account
and Pos.Reference = TT.Reference
and Pos.Date = TT.Date
left join ( select Distinct Account, Reference, Date
from TheTable
where Value < 0
) Neg
on Neg.Account = TT.Account
and Neg.Reference = TT.Reference
and Neg.Date = TT.Date
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the
author, and do not constitute legal or medical advice. This statement is added
to the messages for those lawyers who are too stupid to see the obvious.