| От | Josh Berkus |
|---|---|
| Тема | Re: Problems with substring |
| Дата | |
| Msg-id | web-1642956@davinci.ethosmedia.com обсуждение исходный текст |
| Ответ на | Problems with substring ("Duncan Adams (DNS)" <duncan.adams@vcontractor.co.za>) |
| Список | pgsql-novice |
Ducan, > I am using postgres 7.1.3 > on redhat 7.2. First, please consider upgrading. 7.2.1 has a lot of enhancements over 7.1.3, and we're testing 7.3.0 now! > drop view wm_ups_count; > create view wm_ups_count as > select > substring(phase from 1 for 1) as ups, > sys_key, > count(substring(phase from 1 for 1)) as phas_count > from > power > where > sys_key = 10 > group by > sys_key, > phase; ^^^^^^^^^^^^^ This is your problem. It should be: GROUP BY sys_key, substring(phase from 1 for 1); If you GROUP BY something other than the columns you are displaying, you will often see "duplicate" rows. -Josh Berkus ______AGLIO DATABASE SOLUTIONS___________________________
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера