Oops, I meant to send this to the original poster _and_ the list :-)

Rhino

----- Original Message ----- From: "Rhino" <[EMAIL PROTECTED]>
To: "Frank Rust" <[EMAIL PROTECTED]>
Sent: Friday, December 09, 2005 9:02 AM
Subject: Re: SELECT all except ... ?



----- Original Message ----- From: "Frank Rust" <[EMAIL PROTECTED]>
To: <mysql@lists.mysql.com>
Sent: Friday, December 09, 2005 1:59 AM
Subject: SELECT all except ... ?


Is there a possibility to select all columns from a table except one or two columns? For example I have a table with 30 columns and want all columns but one column *not*. Do I have to write a very long select statement with 29 column names that i want to get?

I've heard requests for "Select all except" for years now but have never seen anyone implement it. Mind you, I've only ever used two SQL databases seriously, DB2 and MySQL, so I can't be sure that Oracle or one of the others doesn't have this ability.

The only thing that I've seen which comes close to what you describe is that DB2 has a set of dialogs that can be used to generate SQL. These dialogs let you select your table name(s) from a list, then select your column name(s) from a list, etc. When you select column names, there is a button for selecting all columns in the table(s), which is the equivalent of "Select *" if you were coding your own SQL. Once you've clicked that button, you can select one, several or all of the columns that were chosen for the query and de-select them again. Therefore, if you clicked "Select all", then de-selected one or two of the columns, it would have the same effect as you want.

Aside from that, I'm not sure why the syntax you want couldn't be added to the SQL language so maybe you should ask for it via a feature request. I could easily imagine a change to SQL that would allow something like this:

select * except e.salary, d.deptname
from employee e inner join department d on e.workdept = d.deptno

Rhino



--
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.371 / Virus Database: 267.13.13/197 - Release Date: 09/12/2005


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to