List:General Discussion« Previous MessageNext Message »
From:Daevid Vincent Date:April 2 2003 1:04am
Subject:How come I can't use an "AS" field in other operations?
View as plain text  
Is this a bug or just not implemented in 3.23.56-Max?

mysql> SELECT alarm_notes, DATE_FORMAT(alarm_date,'%m/%d/%y %h:%i %p') AS
alarm_date_format, IFNULL(CONCAT(contact_fname, ' ', alarm_date),
alarm_date_format) AS contact_name, contact_email, contact_phone FROM
alarm_table LEFT JOIN contact_table ON alarm_contact_table_id = contact_id
WHERE alarm_rep_table_id = '1' ORDER BY alarm_date;
ERROR 1054: Unknown column 'alarm_date_format' in 'field list'


mysql> SELECT alarm_notes, DATE_FORMAT(alarm_date,'%m/%d/%y %h:%i %p') AS
alarm_date_format, IFNULL(CONCAT(contact_fname, ' ', alarm_date),
alarm_date) AS contact_name, contact_email, contact_phone FROM alarm_table
LEFT JOIN contact_table ON alarm_contact_table_id = contact_id WHERE
alarm_rep_table_id = '1' ORDER BY alarm_date;
+---------------------------------------------------------------------------
-------------+-------------------+--------------------------+---------------
--+---------------+
| alarm_notes
| alarm_date_format | contact_name             | contact_email   |
contact_phone |
+---------------------------------------------------------------------------
-------------+-------------------+--------------------------+---------------
--+---------------+
| this is an alarm scheduled for a past date not assigned to a contact, so
it's overdue. | 03/31/03 09:00 PM | 2003-03-31 21:00:00      | NULL
| NULL          |
| this is an alarm scheduled for a future date for this contact
| 04/10/03 02:00 AM | Tony 2003-04-10 02:00:00 | tony@stripped |
425.985.3453  |
+---------------------------------------------------------------------------
-------------+-------------------+--------------------------+---------------
--+---------------+
2 rows in set (0.00 sec)

Thread
How come I can't use an "AS" field in other operations?Daevid Vincent2 Apr
  • re: How come I can't use an "AS" field in other operations?Egor Egorov2 Apr
    • re: How come I can't use an "AS" field in other operations?Daevid Vincent2 Apr
      • re: re: How come I can't use an "AS" field in other operations?Egor Egorov3 Apr