Sign up to create your own snipts, or login.

Public snipts » robertbanh's snipts » database The latest database snipts from robertbanh.

showing 1-2 of 2 snipts for database
  • Count Monthly/Yearly Totals in MySQL
    SELECT 
          MONTHNAME(createDt) AS month,
          YEAR(createDt) AS year,
          COUNT(*) AS total
    FROM tracking
    GROUP BY MONTH(createDt), YEAR(createDt)
    ORDER BY id
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Jan 21, 2010 at 5:01 p.m. EST
  • Use found_rows() in MySQL
    // use found_rows() as a sql function
    mysql> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name
        -> WHERE id > 100 LIMIT 10;
    mysql> SELECT FOUND_ROWS();
    

    copy | embed

    0 comments - tagged in  posted by robertbanh on Jan 21, 2010 at 4:56 p.m. EST
Sign up to create your own snipts, or login.