Alvaro,

>I have a select query where I need to filter the data using the WHERE
>statement. But also need to have an option to show all the data in the
>table.

You cannot send the query engine an "option". When the program determines that all rows are to be retrieved, you could set the WHERE clause to "WHERE 1=1", but why not simply have the program append no WHERE clause at all?

PB

-----

Alvaro Cobo wrote:
Hi all: 

I've searched into the MySQL manual but I can't find the solution to this very silly question. 

I have a select query where I need to filter the data using the WHERE statement. But also need to have an option to show all the data in the table. 

For example (something like...): 

SELECT * FROM `tbl_table1`  WHERE field1 = 'Test' #To show all the rows where field 1= 'Test'

But also have the choice to select all the rows using something like: 

SELECT * FROM `tbl_table1`  WHERE field1 = * or ALL or %  #Select all the fields.

Very thankful in advance. 

Alvaro

PD: System Details: Mysql server version 4.1.11, PHP 4.3.10-2, Debian Sarge. 
  

No virus found in this incoming message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.11.1/104 - Release Date: 9/16/2005