Possible duplicate:
Select all columns except one in MySQL?
I want to know is there a way to select all fields except one field from a table in my database.
I know I can describe the field names in the select query.
For example:
SELECT fieldname1, fieldname2, fieldname3, fieldname4 FROM tablename;
But my question is, is there any way to do it in a simple way... Like this
SELECT * FROM tablename EXCEPT(fieldname3);
I am using MySQL and Zend framework.
you can do it easily like that
lets say your field is an id = 5
then
and if you mean columns
lets say you dont want select
column3
then
if you have many columns
Yes you can fetch from
information_schema.columns
Try this -
Execute this query and fetch the specific field-names and put each field-name into an array. then implode the array with ',' inside the select query.