Discussion:
how to get the last value
(too old to reply)
Uwe Conradi
2010-02-18 16:40:11 UTC
Permalink
Hello everybody,
the functions first or TOP are not working with CE.
I have a table with a structure: Id integer, weight single, MadeOn datetime.
In this table the weights of persons are saved. Now I would like to get all
persons
whose last value of weights > someVariable.
With the sql server it runs fine with First or TOP. How to implement it with
sql server CE?
Thanks
Uwe
Robert Lakinski
2010-02-19 08:57:15 UTC
Permalink
Hi Uwe,

Since nested select statements are not supported in Sql Ce too, you may try
this:

Select a.weight, a.id, a.MadeOn
From Measures as a
Where a. MadeOn in (Select Max (b.Madeon) from Measures as b Where b.id =
a.id )
and a.weight > 70

It will return one value for each person, assuming that there is no more
than one record
for the same person with the same datetime value.

Regards, Robert
Post by Uwe Conradi
Hello everybody,
the functions first or TOP are not working with CE.
I have a table with a structure: Id integer, weight single, MadeOn datetime.
In this table the weights of persons are saved. Now I would like to get
all persons
whose last value of weights > someVariable.
With the sql server it runs fine with First or TOP. How to implement it
with sql server CE?
Thanks
Uwe
Laxmi Narsimha Rao Oruganti [MSFT]
2010-04-15 04:29:48 UTC
Permalink
TOP is supported in SQL CE v3.5 onwards. SQL CE does not support FIRST.

Please provide the exact query you are trying to run so that we can help you
with any issues with the query.

Thanks,
Laxmi
Post by Uwe Conradi
Hello everybody,
the functions first or TOP are not working with CE.
I have a table with a structure: Id integer, weight single, MadeOn datetime.
In this table the weights of persons are saved. Now I would like to get
all persons
whose last value of weights > someVariable.
With the sql server it runs fine with First or TOP. How to implement it
with sql server CE?
Thanks
Uwe
Loading...