dbTalk Databases Forums  

ORDER BY in UNION in postgres 7.3.9

comp.databases.postgresql comp.databases.postgresql


Discuss ORDER BY in UNION in postgres 7.3.9 in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Robert Welz
 
Posts: n/a

Default ORDER BY in UNION in postgres 7.3.9 - 08-05-2008 , 02:44 AM






"SELECT a.*, m.mailbox_name FROM addresses a, mailboxes m,
link_mailbox_addresses lma "
+ "WHERE NOT temp_address AND NOT delete AND a.address_ref > 0 AND
protocol <> ? "
+ "AND a.address_ref = lma.address_ref AND lma.mailbox_ref =
m.mailbox_ref "
+ "UNION SELECT *, '' FROM addresses WHERE address_ref NOT IN "
+ "(SELECT address_ref from link_mailbox_addresses) "
+ "AND NOT temp_address AND NOT delete AND address_ref > 0 AND protocol
<> ? "
+ "ORDER BY site_name ASC, recipient_name ASC");

when last line is replaced with

"ORDER BY UPPER(site_name) ASC, recipient_name ASC"

I get ( postgres 7.3.9) ERROR: ORDER BY on a UNION/INTERSECT/EXCEPT
result must be on one of the result columns
which I don't understand. Can someone explain?

Thank you very much !!

regards,
Robert


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.