Re: SQL request change when upgrade from 7.0.2 to 7.1.3
От | Richard NAGY |
---|---|
Тема | Re: SQL request change when upgrade from 7.0.2 to 7.1.3 |
Дата | |
Msg-id | 3BA5B409.B57A88D2@presenceweb.com обсуждение исходный текст |
Ответ на | SQL request change when upgrade from 7.0.2 to 7.1.3 (Richard NAGY <richard@presenceweb.com>) |
Список | pgsql-sql |
Tom Lane a écrit : <blockquote type="CITE">Richard NAGY <richard@presenceweb.com> writes: <br />> SELECT aes.ent_id,e.type, e.nom, aes.sect_id as voulu, <br />> cvd_new(current_date, e.date_entree, 'new') FROM ass_entrep_sectactaes, <br />> entreprise e WHERE e.id = aes.ent_id and aes.sect_id <> 3 and <br />> aes.sect_id<> 9 <br />> and aes.sect_id <> 1 and aes.sect_id <> 13 and aes.sect_id = 56 <br />> UNION<br />> SELECT distinct on (aes.ent_id) aes.ent_id, e.type, e.nom, aes.sect_id, <br />> cvd_new(current_date,e.date_entree, 'new') FROM ass_entrep_sectact aes, <br />> entreprise e WHERE e.id = aes.ent_id andaes.sect_id <> 3 and <br />> aes.sect_id <> 9 <br />> and aes.sect_id <> 1 and aes.sect_id <>13 and aes.sect_id <> 56 and <br />> aes.ent_id <br />> not in (SELECT ent_id FROM ass_entrep_sectactWHERE sect_id = 56 and <br />> sect_id <> 3 <br />> and sect_id <> 9 and sect_id <>1 and sect_id <> 13) ORDER BY e.type, <br />> e.nom <p>ORDER BY applied to the result of a UNION has tobe on the output <br />columns of the UNION. "e.type" etc are names of input-table columns. <br />Try just "type" and"nom", which will refer to the second and third <br />output columns of the UNION. <p>Pre-7.1 got this wrong (and wouldsometimes produce wrong output <br />ordering or even a backend crash, if the arms of the UNION didn't <br />all yieldthe same datatype). <p> regards, tom lane</blockquote> Hello Tom, <p>Yes, thanks a lot. It works!<br />Regards. <pre>-- Richard NAGY Presenceweb</pre>
В списке pgsql-sql по дате отправления: