Search
 
SCRIPT & CODE EXAMPLE
 

SQL

mysql select max and corresponding row

SELECT a.id, a.rev, a.contents
FROM YourTable a
INNER JOIN (
    SELECT id, MAX(rev) rev
    FROM YourTable
    GROUP BY id
) b ON a.id = b.id AND a.rev = b.rev
Comment

mysql select max and corresponding row

SELECT a.*
FROM YourTable a
LEFT OUTER JOIN YourTable b
    ON a.id = b.id AND a.rev < b.rev
WHERE b.id IS NULL;
Comment

PREVIOUS NEXT
Code Example
Sql :: get who is hired in january in sql 
Sql :: USING THE NOT CONDITION IN SQL 
Sql :: psql create usr 
Sql :: c# add a textbox in mysql select 
Sql :: != not working in mysql 
Sql :: pl sql constraint user function 
Sql :: sql syntax chekcer 
Sql :: add alternate add column sql 
Sql :: ring connect to the database using the odbc_connect() 
Sql :: first row in deluge 
Sql :: use between operator in mysql 
Sql :: ring MySQL enable or disable the auto commit feature 
Sql :: contact mysql column field 
Sql :: can you create views in dbbrowser 
Sql :: sakila database erd postgresql 
Sql :: set Mamp mysql globally 
Sql :: mysql password reset 
Sql :: VSCode SQL Server Connection error 
Sql :: declare row variable sql server 
Sql :: oarcale list objects 
Sql :: hive batch drop table 
Sql :: utiliser sql ligne de commande 
Sql :: create mysql pool connection python flask 
Sql :: sql compound operators 
Sql :: mysql utc to toronto time 
Sql :: in operator in sql 
Sql :: how to run sql query in mysql workbench 
Sql :: convert google analytics dathourminute to time stamp? sql 
Sql :: raiserror sql 
Sql :: jooq finding lastest value in table 
ADD CONTENT
Topic
Content
Source link
Name
9+4 =