![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
The query is the last but one UPDATE employees SET last_closed_deal = deal.id FROM accounts JOIN deals ON (account.id = deal.account_id) WHERE deal.employee_id = employees.id AND deal.name = 'Rocket Powered Skates' AND accounts.name = 'Acme Corporation' ORDER BY deal.signed_date DESC LIMIT 1; this query is not correct and doesn't work with postgresql 8.1. |
|
My query that doesn't work is the first and I modify it in second form that is the correct one. |
#3
| |||
| |||
|
|
"Massimo Fidanza" <malix0 (AT) gmail (DOT) com> writes: this query is not correct and doesn't work with postgresql 8.1. It still works, if you enable add_missing_from. |
#4
| |||
| |||
|
|
I wrote: "Massimo Fidanza" <malix0 (AT) gmail (DOT) com> writes: this query is not correct and doesn't work with postgresql 8.1. It still works, if you enable add_missing_from. I take that back --- FROM is not the issue (indeed, it has one). The problem is the ORDER BY and LIMIT clauses. I dunno who put in this example, but I'd like some of what they were smoking. I've taken it out again, since without that it's not really showing anything that the prior examples don't cover. regards, tom lane |
|
But yes the problem is not with FROM but with ORDER BY or GROUP BY.<br>As = you can see in my query I need to GROUP BY modelloid ad aggregate<br>on npe= |
![]() |
| Thread Tools | |
| Display Modes | |
| |