Tag: mysql

  • group by in MySQL example only date from datetime

    MySQL Example

    SELECT date(created_at),count(*) FROM `users` WHERE 1 group by date(created_at) ORDER BY `date(created_at)` DESC

    Laravel Example with groupByRaw

     $data = DB::connection('default')->table('users')->select(DB::raw('DATE(created_at) date'),DB::raw('count(created_at) as page_count'))->groupByRaw('DATE(created_at)')->get();

    Laravel Example with groupBy

     $data = DB::connection('default')->table('users')->select(DB::raw('DATE(created_at) created_date'),DB::raw('count(created_at) as page_count'))->groupBy('created_date')->get();
  • how to change phpmyadmin url in apache ubuntu

    For ubuntu (i used ubuntu 12.04), the default phpmyadmin apache configuration can be found at /etc/phpmyadmin/apache.conf

    You can open it by type sudo nano /etc/phpmyadmin/apache.conf and change the third

    Alias /yournewalias /usr/share/phpmyadmin

    To restart apache service

    sudo service apache2 restart