MySQL

Oracle-like ROWNUM in MySQL

Oracle-like ROWNUM in MySQL

It needs sometimes to exactly mimic Oracle's ROWNUM where is no possibility to initiate a counter in previous statement by

SET @rownum:=0

;.

It is still possible in a single SQL.

SELECT @rownum:=@rownum+1 rownum, t.*FROM (SELECT @rownum:=0) r, mytable t;

archived from Mark Malakanov

Convert Moodle Timestamp fields to Date

I get really frustrated with Moodle for using int fields to store dates. They store it in the Unix (Epoch) format. Here's how to make it more readable.

Syndicate content