In article <CvEzx7.Jz7@Newbridge.COM>, psingh@Newbridge.COM
(Pawan Singh) writes:
|> Hi I wanted to know if I can have a select statement
|> in which columns are selected depending upon the result
|> of the query.
|>
|> For example, I have a table A and depending on a type column
|> in A, one can find extra information in B or C. For example
|> table A can be employees and table B and C can be managers
|> and others.
|>
|> Now I want to frame a query which returns me A.x, A.y, B.z
|> or A.x, A.y, C.zz, depending upon the value of A.a.
|>
|> Is it possible to do that?
In the SQL2 (also called SQL-92) standard, it is possible to do
this using the CASE-expression in the SELECT list. (See Melton &
Simon's book on the new SQL standard).
However, as far as I know, none of the DBMSs currently on the
market support SQL-92 yet ...
--
Robert Marti | Phone: +41 1 632 72 60
Informationssysteme | FAX: +41 1 632 11 72
ETH-Zentrum | E-Mail: marti@inf.ethz.ch
CH-8092 Zurich, Switzerland |
**** please note new fax number as of August 15 1994 ****