Does MySQL accept ORDER BY "nothing" LIMIT "all" when I only want to get number of results in a search query?
I have ported a search from Coldfusion into a MySQL stored procedure. 

The actual search is run twice on the site. Once to get the number of records, the 2nd time to get the actual results to display.

So both MySQL syntax differ in the last two lines:

Get no of records: 

     SELECT ...
     GROUP BY a, b, c
     HAVING ... 

Actual results:

     SELECT ...
     GROUP BY a, b, c
     HAVING ... 
     ORDER BY var1, var2
     LIMIT var_start, var_end

**My question**:  
Since I need to run this twice, is there a way to at least use the same stored procedure = can I add default values such as **"ORDER BY 'nothing' LIMIT 'all'**, so when I call the proc to get the no of results it just disregards both values, but when I'm querying results and passing parameters, both are used?

Sort of like an if statement

    WHERE 1
    AND IF( var_x = '', '.', var_x = some_value )

Thanks for input!
Does MySQL accept ORDER BY "nothing" LIMIT "all" when I only want to get number of results in a search query?
===

I have ported a search from Coldfusion into a MySQL stored procedure. 

The actual search is run twice on the site. Once to get the number of records, the 2nd time to get the actual results to display.

So both MySQL syntax differ in the last two lines:

Get no of records: 

     SELECT ...
     GROUP BY a, b, c
     HAVING ... 

Actual results:

     SELECT ...
     GROUP BY a, b, c
     HAVING ... 
     ORDER BY var1, var2
     LIMIT var_start, var_end

**My question**:  
Since I need to run this twice, is there a way to at least use the same stored procedure = can I add default values such as **"ORDER BY 'nothing' LIMIT 'all'**, so when I call the proc to get the no of results it just disregards both values, but when I'm querying results and passing parameters, both are used?

Sort of like an if statement

    WHERE 1
    AND IF( var_x = '', '.', var_x = some_value )

Thanks for input!