query syntax question
От | Lance Massey |
---|---|
Тема | query syntax question |
Дата | |
Msg-id | 85939b60c143228dda4aaaf35cfe68fb@neuropop.com обсуждение исходный текст |
Ответы |
Re: query syntax question
|
Список | pgsql-novice |
I'm migrating from mySQL where my database tables have an "ID" column and a an "ID_extended" column. This was done so I could keep a history e.g. a customer gets an ID when signing on then if they move a new row is inserted, keeping the old ID, but incrementing the extended ID. I'm sure there's a better way, but I digress. In mySQL I could select the most recent addresses with "Select *, max(ID_extended) from customers group by ID" In postgreSQL that apparently doesn't work. If if do: "Select ID, max(ID_extended) from customers group by ID" I get a list of the the correct IDs and extended IDs - however, I can't seem to structure a query where I also retrieve address info. Is there a way to use the results of that query as inputs to another? Or is there a better way to write the previous query? Or should I re-think the data structure since postgreSQL has objects and arrays available?... thanks, L
В списке pgsql-novice по дате отправления: