Re: greetings
От | Tom Lane |
---|---|
Тема | Re: greetings |
Дата | |
Msg-id | 15301.983052160@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: greetings (Ken Kline <ken@oldbs.com>) |
Список | pgsql-sql |
Ken Kline <ken@oldbs.com> writes: > orginally what I wanted to do was this: > INSERT INTO pledge_classes (semester, year) > SELECT distinct pseason, pyear from load_bros > WHERE pyear is not null > AND pseason is not null > order by pyear, pseason; > however pgsql does not allow order by in an INSERT-SELECT statement Three answers for the price of one ;-) : 1. Why are you trying to constrain the order in an INSERT in the first place? Tuple order in a table is meaningless under SQL semantics. 2. If you really feel you have to have that, you could rely on the sorting done implicitly by DISTINCT: INSERT INTO pledge_classes (year, semester)SELECT distinct pyear, pseason from load_brosWHERE pyear is not nullAND pseasonis not null; 3. 7.1 will allow you to use an ORDER BY here, pointless though it is. regards, tom lane
В списке pgsql-sql по дате отправления: