Re: weekdays display in postgresql - Mailing list pgsql-novice

From Jude DaShiell
Subject Re: weekdays display in postgresql
Date
Msg-id alpine.NEB.2.00.1408300600180.1596@panix1.panix.com
Whole thread Raw
List pgsql-novice
My reason for putting the weekday number as the last field in chealth.sql
shared earlier is that whenever I put it just after date, the phealth.sql
script I'll share with the list now always threw an error and wouldn't
provide output for me.
cut here.
--- query: phealth.sql
--- by Jude DaShiell & Tim Chase
--- Last Updated: 2014-07-31 06:51
select
min(date) as "starting date:",
max(date) as "ending date:",
count(cystalic_pressure) as "Cystalic sample size:",
  round(avg(cystalic_pressure),1) as "Average Cystalic Pressure:",
min(cystalic_pressure) as "Min Cystalic Pressure:",
max(cystalic_pressure) as "Max cystalic Pressure:",
  (select cystalic_pressure
   from health
   group by cystalic_pressure
   order by count(cystalic_pressure) desc, cystalic_pressure
   limit 1) as "Mode Cystalic Pressure:",
count(dyastalic_pressure) as "dyastalic sample size:",
round(avg(dyastalic_pressure),1) as "Average Dyastalic Pressure:",
min(dyastalic_pressure) as "Min Dyastalic Pressure:",
Max(dyastalic_pressure) as "Max Dyastalic Pressure:",
  (select dyastalic_pressure
   from health
   group by dyastalic_pressure
   order by count(dyastalic_pressure) desc, dyastalic_pressure
   limit 1) as "Mode Dyastalic Pressure:",
count(pulse) as "Pulse Sample Size:",
round(avg(pulse),1) as "Average Pulse:",
min(pulse) as "Min Pulse:",
max(pulse) as "Max Pulse:",
  (select pulse
   from health
   group by pulse
   order by count(pulse) desc, pulse
   limit 1) as "Mode Pulse:",
count(blood_sugar) as "Sugar Sample Size:",
  round(avg(blood_sugar),1) as "Average Sugar:",
min(blood_sugar) as "Min Sugar:",
max(blood_sugar) as "Max Sugar:",
  (select blood_sugar
   from health
   group by blood_sugar
   order by count(blood_sugar) desc, blood_sugar
   limit 1) as "Mode Sugar:"
from health;

The last script used to actually populate the health table is made by
using the uhealth.sh script I shared earlier.  So for weekdays in this
context to really be useful, as soon as a date is keyed into the system a
field adjacent to date would have to take the date as input and generate
the weekday and populate the adjacent weekday field.  Where to do this and
with what code I do not yet know.




pgsql-novice by date:

Previous
From: David G Johnston
Date:
Subject: Re: logical fields with defaults
Next
From: David G Johnston
Date:
Subject: Re: C partition management