vendredi 4 avril 2014

PostgreSQL: Group by, where, having with date interval


Vote count:

0




Hi I'm trying to create a select group by dialed number and date. I'm using PostgreSQL and unfortunately I can not get a satisfactory result. Who can help me I will be grateful. (sorry my bad english, I'm using google translator) I was trying to use this select:


SELECT callerid, to_no, is_fromoutside, ---starttime::date, --to_char(starttime,'DD-MM-YYYY'), --starttime,



count(to_no),
count(starttime)


FROM callhistory3


where starttime between '2014/03/21' and '2014/04/21'


group by callerid, to_no, from_no, is_fromoutside, starttime


having



is_fromoutside='f'


and callerid like '9030' and to_no not like '9%'


order by starttime desc


;


result:


"9030";"00262733319999";f;"2014-04-03";1


"9030";"00262733319999";f;"2014-04-03";1


"9030";"002614996837199";f;"2014-03-28";1


"9030";"032280840";f;"2014-03-28";1


"9030";"020156128";f;"2014-03-25";1


"9030";"0989168482";f;"2014-03-25";1


"9030";"0987131781";f;"2014-03-25";1



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire