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

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -