smoothing

  • Thread starter Thread starter Olivier
  • Start date Start date
O

Olivier

Hello
My problem:
I have datas like

A B
A001 2007-10-01
A003 2007-10-05
A004 2007-10-04
A008 2007-10-06

I want to make a query ordered by column A skipping value where column B
is lower than previous (eg A004):

A B
A001 2007-10-01
A003 2007-10-05
A008 2007-10-06

If someone can help, thanks.
 
hi Olivier,
I want to make a query ordered by column A skipping value where column B
is lower than previous (eg A004):
If someone can help, thanks.
This cannot be done with a query.


mfG
--> stefan <--
 
The following MIGHT work (Untested speculation)

SELECT A, B
FROM TheTable
WHERE B >
(SELECT First(B)
FROM TheTable as Temp2
WHERE Temp2.A =
(SELECT Max(A)
FROM TheTable as Temp
WHERE Temp.A < TheTable.A))

--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..
 
I think we can remove a level of nesting:

SELECT a, b
FROM theTable
WHERE b = (SELECT MAX(temp2.b)
FROM theTable AS temp2
WHERE temp2.a <= theTable.a)
ORDER BY a


The two solutions differ, though, since this one can give horizontal steps,
two successive records with the same B value are possible, while John's one
give strictly increasing values for B.


Vanderghast, Access MVP
 
Back
Top