using count in other column
От | bartjoosen |
---|---|
Тема | using count in other column |
Дата | |
Msg-id | 24622738.post@talk.nabble.com обсуждение исходный текст |
Ответы |
Re: using count in other column
|
Список | pgsql-sql |
Hi, I made up a query to make a count for each item for each month/year: SELECT"Artnr_ID", to_char("Date_plan","YYYY") AS "Jaar", to_char("Date_plan","MM") AS "Maand", Count("tblArtnrs"."Artikelnr") AS "Monthly_count", "val1","val2","val3" FROM (("tblAnalyses" INNER JOIN "tblStudies" ON "tblAnalyses"."Studie_ID" = "tblStudies"."Studie_ID") INNER JOIN "tblFichenr" ON "tblStudies"."ID_fichenr" = "tblFichenr"."ID") INNER JOIN "tblArtnrs" ON "tblFichenr"."ID_Art_nrs" = "tblArtnrs"."Artnr_ID" GROUP BY "tblArtnrs"."Artnr_ID", to_char("Date_plan","YYYY") , to_char("Date_plan","MM"), "val1","val2","val3"; Now I want to use the "Monthly_count" value for further calculations with other columns. I tried to use "Monthly_count"+ "val1" + "Monthly_count" * "val2" + "Monthly_count" *"val3" But "Monthly_count" is not recognised in my calculations. How can this be solved? Thanks Bart -- View this message in context: http://www.nabble.com/using-count-in-other-column-tp24622738p24622738.html Sent from the PostgreSQL - sql mailing list archive at Nabble.com.
В списке pgsql-sql по дате отправления: