Most Recent Queries
I am developing a knowledge base search site that allows user to conduct search
based on most recent search queries stored in the database.
The query Table I have looks like this:
query_ID (primary key int)
I have tried to use "select distinct top x" in combination with "order by
dateInserted desc" to obtain the most recent unique searches but so far I
have received error or not successfully produce an accurate resultset, either
there are still sqlString duplication or the it's not the most recent one.
It seems that top distinct cannot work well with date sorting. The closest
one I have is this sql:
"select distinct top 5 querystring, dateInserted from autoQuery order by
But since dateInserted is stored in yyy-mm-dd hh:mm:ss.xxx format, it doesn't
not effectively eliminate the duplicated sqlString. The other one I have
"select distinct top 5 querystring from autoQuery order by dateInserted"
I got error for this and it says I need to include dateInserted on the search
Can someone please help me with the workaround of this?
Thanks a lot!
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center