SELECT top 10 from MS Access
Posted on 2011-02-26
I use the code below to select 10 newest articles:
strsql = "SELECT top 10 * FROM " & TABLE_NAME
if id > 0 then
strsql = strsql & " WHERE " & COL_ID & "=" & id
strsql = strsql & " AND Article_start_date <= now() "
strsql = strsql & " WHERE Article_start_date <= now() "
strSql = strSql & " ORDER BY [Article_ID] desc;"
rs.open strsql, conn, 2, 2
I wan't to order the 10 newest articles by Article_Hits so the most readed article will be listed first.
When I change:
ORDER BY [Article_ID] desc;"
ORDER BY [Article_ID] desc, [Article_Hits] desc;"
Then I get some very old articles, not the 10 newest.
How can I get the 10 newest aricles and only orderby Article_Hits on that same 10 articles?