Archive for the ‘MySQL’

  • Find week start/end given week number
    I have a table with some dated records. I wanted to do some weekly reports on this data. MySQL has a nifty function dubbed WEEK() which will return a week number. It allows you to break your data into week long intervals very easily. For example, the following query will tell me how many records came in each week: SELECT COUNT(*), WEEK(mydate) FROM mytable GROUP BY WEEK(mydate); The...
    by Nauman at November 3rd, 2009 at 07:11 am
  • MINUS query in MySQL
    Mysql does not support MINUS operator which is not the end of the world. For most queries you can really care less if it’s implemented or not. My web app never needs to use it to function properly, which makes MySQL a perfect choice here. But, sometimes human beings are more demanding than simple php applications. Especially if you want to extract some non-obvious...
    by Nauman at November 3rd, 2009 at 07:11 am