dynamic alias?
am 27.08.2010 18:16:46 von Eric Bloomquist
Hi all,
I'm wondering if it's possible to have a dynamic alias in MySQL. The
result I'm looking for is essentially:
+-----------------+---------------------------+------------- -------+
| Provider Name | Facility Name | Appts on 8/28/2010 | =
<==
+-----------------+---------------------------+------------- -------+
| Mildred Ratched | Oregon State Hospital | 12 |
| Henry Jekyll | London Internal Medicine | 3 |=20
| ... | | |
Where "Appts on 8/28/2010" instead includes whatever tomorrow's date is
when the query is run.
Is it possible to do something like this in a MySQL query?
Thanks,
Eric
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
Re: dynamic alias?
am 27.08.2010 18:56:35 von Peter Brawley
On 8/27/2010 11:16 AM, Eric Bloomquist wrote:
> Hi all,
>
> I'm wondering if it's possible to have a dynamic alias in MySQL. The
> result I'm looking for is essentially:
See the manual page for PREPARE.
PB
-----
> +-----------------+---------------------------+------------- -------+
> | Provider Name | Facility Name | Appts on 8/28/2010 |<==
> +-----------------+---------------------------+------------- -------+
> | Mildred Ratched | Oregon State Hospital | 12 |
> | Henry Jekyll | London Internal Medicine | 3 |
> | ... | | |
>
> Where "Appts on 8/28/2010" instead includes whatever tomorrow's date is
> when the query is run.
>
> Is it possible to do something like this in a MySQL query?
>
> Thanks,
> Eric
>
>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
RE: dynamic alias?
am 27.08.2010 19:43:42 von Steven Staples
DATE_ADD(NOW(), INTERVAL 1 DAY) will give you tomorrow...
Not sure if that is what you're looking for or not...
Steven Staples
> -----Original Message-----
> From: Eric Bloomquist [mailto:Eric_Bloomquist@cooley-dickinson.org]
> Sent: August 27, 2010 12:17 PM
> To: mysql@lists.mysql.com
> Subject: dynamic alias?
>
> Hi all,
>
> I'm wondering if it's possible to have a dynamic alias in MySQL. The
> result I'm looking for is essentially:
>
> +-----------------+---------------------------+------------- -------+
> | Provider Name | Facility Name | Appts on 8/28/2010 | <==
> +-----------------+---------------------------+------------- -------+
> | Mildred Ratched | Oregon State Hospital | 12 |
> | Henry Jekyll | London Internal Medicine | 3 |
> | ... | | |
>
> Where "Appts on 8/28/2010" instead includes whatever tomorrow's date is
> when the query is run.
>
> Is it possible to do something like this in a MySQL query?
>
> Thanks,
> Eric
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=sstaples@mnsi.net
>
> No virus found in this incoming message.
> Checked by AVG - www.avg.com
> Version: 9.0.851 / Virus Database: 271.1.1/3089 - Release Date: 08/27/10
> 02:34:00
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
RE: dynamic alias?
am 27.08.2010 20:59:59 von Eric Bloomquist
Thanks, PREPARE certainly has some potential.
Unfortunately, when I try to use that sort of thing inside of a Cognos
report, it complains that "At least one expression in the Select clause
is missing the AS clause to make it a proper alias."
(Sorry I didn't include the Cognos context -- it didn't occur to me that
it'd be relevant.)
Thanks,
Eric
-----Original Message-----
From: Peter Brawley [mailto:peter.brawley@earthlink.net]=20
Sent: Friday, August 27, 2010 12:57 PM
To: mysql@lists.mysql.com
Subject: Re: dynamic alias?
On 8/27/2010 11:16 AM, Eric Bloomquist wrote:
> Hi all,
>
> I'm wondering if it's possible to have a dynamic alias in MySQL. The
> result I'm looking for is essentially:
See the manual page for PREPARE.
PB
-----
> +-----------------+---------------------------+------------- -------+
> | Provider Name | Facility Name | Appts on 8/28/2010
|<==
> +-----------------+---------------------------+------------- -------+
> | Mildred Ratched | Oregon State Hospital | 12 |
> | Henry Jekyll | London Internal Medicine | 3 |
> | ... | | |
>
> Where "Appts on 8/28/2010" instead includes whatever tomorrow's date
is
> when the query is run.
>
> Is it possible to do something like this in a MySQL query?
>
> Thanks,
> Eric
>
>
--=20
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/mysql?unsub=3DEric_Bloomquist@cooley- dickinson.org=
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
Re: dynamic alias?
am 27.08.2010 22:56:01 von Michael Dykman
It would be easiest if you showed us the query you are using but the
simple column alias has been in MySQL since v2
SELECT foo, count(*) bar AS mycount FROM...
In keeping with SQL practice, the 'AS' keyword is optional but it does
make it easier to see the syntax.
This is equivalent:
SELECT foo, count(*) bar mycount FROM...
- michael dykman
On Fri, Aug 27, 2010 at 2:59 PM, Eric Bloomquist
wrote:
> Thanks, PREPARE certainly has some potential.
>
> Unfortunately, when I try to use that sort of thing inside of a Cognos
> report, it complains that "At least one expression in the Select clause
> is missing the AS clause to make it a proper alias."
>
> (Sorry I didn't include the Cognos context -- it didn't occur to me that
> it'd be relevant.)
>
> Thanks,
> Eric
>
>
> -----Original Message-----
> From: Peter Brawley [mailto:peter.brawley@earthlink.net]
> Sent: Friday, August 27, 2010 12:57 PM
> To: mysql@lists.mysql.com
> Subject: Re: dynamic alias?
>
> =A0On 8/27/2010 11:16 AM, Eric Bloomquist wrote:
>> Hi all,
>>
>> I'm wondering if it's possible to have a dynamic alias in MySQL. =A0The
>> result I'm looking for is essentially:
> See the manual page for PREPARE.
>
> PB
>
> -----
>> +-----------------+---------------------------+------------- -------+
>> | Provider Name =A0 | Facility Name =A0 =A0 =A0 =A0 =A0 =A0 | Appts on 8=
/28/2010
> |<==
>> +-----------------+---------------------------+------------- -------+
>> | Mildred Ratched | Oregon State Hospital =A0 =A0 | =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 12 |
>> | Henry Jekyll =A0 =A0| London Internal Medicine =A0| =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 =A0 =A03 |
>> | ... =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 | =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0|
>>
>> Where "Appts on 8/28/2010" instead includes whatever tomorrow's date
> is
>> when the query is run.
>>
>> Is it possible to do something like this in a MySQL query?
>>
>> Thanks,
>> Eric
>>
>>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=3DEric_Bloomquist@cooley- dickinson.org
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: =A0 =A0http://lists.mysql.com/mysql?unsub=3Dmdykman@gmail=
..com
>
>
--=20
=A0- michael dykman
=A0- mdykman@gmail.com
=A0May the Source be with you.
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg