sql server - SQL: How To Use DateDiff + ORDER BY with INNER JOIN -
here existing sql statement:
select top 10 users.firstname + ' ' + users.lastname name, feeds.logtype, feeds.logdesc, feeds.timestamp = datediff(minute, feeds.timestamp, current_timestamp) feeds inner join users on feeds.userid = users.userid order feeds.timestamp desc
i having errors on 2nd line, incorrect syntax near '='.
any ideas how fix this?
try
select top 10 users.firstname + ' ' + users.lastname name ,feeds.logtype ,feeds.logdesc ,datediff(minute, feeds.timestamp, current_timestamp) feeds inner join users on feeds.userid = users.userid order datediff(minute, feeds.timestamp, current_timestamp) desc
Comments
Post a Comment