你好,我有一个带列的表:
Hello I have a table with columns:
*使用oracle
ID NUMBER
USER_ID NUMBER
DATE_ADDED DATE
DATE_VIEWED DATE
DOCUMENT_ID VARCHAR2
URL VARCHAR2
DOCUMENT_TITLE VARCHAR2
DOCUMENT_DATE DATE
我想知道如何获取给定用户最近添加的文档.
I want to know how i can get the most recently added document for a given user.
Select * FROM test_table WHERE user_id = value AND (do something with date_added column)
谢谢
Select *
FROM test_table
WHERE user_id = value
AND date_added = (select max(date_added)
from test_table
where user_id = value)
这篇关于SQL 如何选择最近的日期项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!