Click to See Complete Forum and Search --> : question about SQL QUERY


pelegk1
08-19-2003, 06:31 AM
how do u right a query that
select the the last 10 lines that i inserted into the data base
depending on a column that i write there the date,
which called last_update'and on base of that column i want to get the last 10 updates rows!

thanks in advance
peleg

rdoekes
08-19-2003, 01:31 PM
I think this could also be done with only SQL
Does this give you the desired results?
SELECT TOP 10 *
FROM table1
ORDER BY update_date DESC

However, you are getting the rows in descending order. If that is not the way you want it, then this is not the solution you need.

Thanks,

-Rogier

pelegk1
08-20-2003, 01:42 AM
i want all the last 10 updated result but only up to yesterday how do i do that?
10X:) again
peleg

pelegk1
08-21-2003, 12:55 AM
i tried using # and it didnt help:(
the SqlStr is like this :
"select ID " &_
"from tb1 WHERE " &_
STATUS_ID='1' and update_date<#" Date() &"#" &_
" ORDER BY publish Desc"

and it isnt working:(((
in the db the update_date is defined as smalldate like this :
20,08,2003 10:59:43

where choould be the problem?

rdoekes
08-21-2003, 01:31 AM
If you are using SQL server, try to replace the # with '. The # is Access syntax

pelegk1
08-21-2003, 02:44 AM
a diffrent thing :
DATEDIFF(d," & Date()& ",update_date)<0

and it gives me an empty answer:(((((