I did this on my computer

create table site_calendar_v2 (
id int,start date,end date,global int,
status varchar(20),time timestamp not null default now());

SELECT A.ID,A.Start,A.End
FROM ((SELECT ID, Start, End FROM site_calendar_v2 as c WHERE Global='1' ) 
UNION ( SELECT '99999', '2006-11-01', '0000-00-00')) A
ORDER BY End, Start ASC, Status DESC, Time ASC;

When I ran it, it gave me this

ERROR 1054 (42S22): Unknown column 'Status' in 'order clause'

Just extend the SELECT list to have the STATUS and a TIME like this:

SELECT A.ID,A.Start,A.End
FROM ((SELECT ID, Start, End , STATUS, TIME FROM site_calendar_v2 as c WHERE 
Global='1' ) 
UNION ( SELECT '99999', '2006-11-01', '0000-00-00', 'no status', '0000-00-00 
00:00:00')) A
ORDER BY End, Start ASC, Status DESC, Time ASC;

With no rows in the site_calendar_v2 table, I got back this:

+-------+------------+------------+
| ID    | Start      | End        |
+-------+------------+------------+
| 99999 | 2006-11-01 | 0000-00-00 |
+-------+------------+------------+

Give it a try.

----- Original Message -----
From: Gerald L. Clark <[EMAIL PROTECTED]>
To: Keith Spiller <[EMAIL PROTECTED]>
Cc: [MySQL] <mysql@lists.mysql.com>
Sent: Wednesday, November 1, 2006 4:51:21 PM GMT-0500 US/Eastern
Subject: Re: Manually Inserted Data

Keith Spiller wrote:
> Hi Rolando,
> 
> Thanks for your help.
> 
> I have reduced the query to the bare essensials to try to test the 
> concept, but
> it still fails...
> 
> ( SELECT ID, Start, End
( SELECT ID, Start, End as z
> FROM site_calendar_v2 as c
> WHERE Global='1' )
> UNION
> ( SELECT '99999', '2006-11-01', '0000-00-00' as z )
> ORDER BY z, Start ASC, Status DESC, Time ASC  a
> 
> Does anyone see my mistake?
> 
> Keith
> 


-- 
Gerald L. Clark
Supplier Systems Corporation

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



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

Reply via email to