How to group by with rollup? How to get booking records from booking table? How to get GROUP BY function WITH ROLLUP?

Here is my SQL query:

SELECT * FROM booking 
GROUP BY startBooking WITH ROLLUP;


How to convert above query in Drupal 7?

     $queryPrice = db_select('booking', 'b');
     $queryPrice-&gt;fields('b');  
     $queryPrice-&gt;groupBy('b.startBooking');       
     $resultPrice = $queryPrice-&gt;execute();


How to roll up use in above query in Drupal 7?
You can add a GROUP modifier right to the end of the string:

$queryPrice-&gt;groupBy('b.startBooking WITH ROLLUP');


With the rest of your query Drupal produces:

SELECT  b.*
FROM 
{booking} b
GROUP BY b.startBooking WITH ROLLUP