Subject Re: Select last - How to select latest data
Author Svein Erling Tysvær
--- In, "menjit_singh" wrote:
> Sorry about the empty reply, my son keep pressing the mouse...

If he's less than 10 years old that's fine, if he is a teenager, maybe
you should consider his advice and take a few hours off the computer
and play some football or similar with him and if he is 35 like me,
well, then he's either got a strange sense of humour or you've got a
potential problem that this list probably cannot solve.

> I used method 1 as you have told, double ((__)) and ASC. the error i
> got is 'Access Violation at address 00404BBA...'


> The reason i need the latest 30 days data is because the stock
> information is not upto date (eg is not up today's date). some stock
> data are 5 days old, 10 days and some 30 days old.

Now, this sounds different. What about

D1.HIGH, D1.LOW, D1.DATA, D1.symbol FROM DATA D1
WHERE D1.STOCK='''+imya+''' AND
WHERE D2.STOCK='''+imya+''')
order by D1.DATA'

and have a descending index for DATA?

(or use parameters as Helen suggested, that is at least as good a
suggestion. By the way, Helen, in Russian imya simply means 'name' and
if this is part of a statement in Delphi, then he simply wants STOCK
to equal the content of his variable IMYA).

Alan is correct in that using COUNT is slow if the count is huge,
though it only matters if you add more data to your table for the same