llmclaughlin
Programmer
With the below query, I need to know the count of records per date. When I add the count(*) into mix then it breaks the group by as shown in image 2. What I'm trying to achieve is getting the sum of records (COUNT(*)) per grt_wr_grouping_analyst on a date.
Current query
SELECT DISTINCT tdee.grt_wr_grouping_analyst,
trunc(tdee.errupdateddate)
AS errupdateddate
FROM tbl_dom_exp_error tdee
WHERE SUBSTR (tdee.recpnm_pkg_seq, 13, 2) = 'CL'
AND SUBSTR (tdee.recpnm_pkg_seq, 20, LENGTH(0)) = 0
AND tdee.trkngnbr IS NULL
AND ( ( tdee.grt_comment IS NOT NULL
AND tdee.errortype IS NOT NULL
AND (tdee.errormsg IS NOT NULL OR tdee.errormsg = ''))
OR (tdee.grt_comment IS NOT NULL AND tdee.errortype IS NOT NULL
AND (tdee.comments_vchar IS NOT NULL OR tdee.comments_vchar = '')))
GROUP BY tdee.errupdateddate,tdee.grt_wr_grouping_analyst
ORDER BY tdee.grt_wr_grouping_analyst
Image 1
This is what I want with number of records per date
GRT_WR_GROUPING_ANALYST ERRUPDATEDDATE
110038 4/9/2010
285717 4/7/2010
285717 4/8/2010
285717 4/9/2010
285717 4/13/2010
459180 4/7/2010
459180 4/8/2010
459180 4/9/2010
Image 2
What I get when add count(*) in select
GRT_WR_GROUPING_ANALYST ERRUPDATEDDATE CNTME
110038 4/9/2010 2
285717 4/7/2010 1
285717 4/7/2010 2
285717 4/7/2010 3
285717 4/7/2010 4
285717 4/7/2010 6
285717 4/8/2010 1
285717 4/8/2010 2
285717 4/8/2010 3
285717 4/8/2010 4
285717 4/8/2010 5
285717 4/8/2010 7
285717 4/8/2010 8
285717 4/8/2010 14
285717 4/8/2010 15
285717 4/8/2010 16
285717 4/8/2010 20
285717 4/8/2010 28
285717 4/8/2010 29
285717 4/8/2010 32
285717 4/8/2010 34
285717 4/8/2010 36
285717 4/8/2010 40
285717 4/8/2010 41
285717 4/8/2010 43
285717 4/9/2010 1
285717 4/9/2010 2
285717 4/9/2010 3
285717 4/9/2010 4
285717 4/9/2010 10
285717 4/9/2010 15
285717 4/9/2010 17
285717 4/9/2010 19
285717 4/9/2010 21
285717 4/9/2010 25
285717 4/9/2010 27
285717 4/9/2010 28
285717 4/9/2010 32
285717 4/9/2010 35
285717 4/9/2010 40
285717 4/13/2010 1
285717 4/13/2010 20
459180 4/7/2010 1
459180 4/7/2010 3
459180 4/8/2010 1
459180 4/8/2010 2
459180 4/9/2010 1
Hope this is clear
Thanks in advance
Louie
Current query
SELECT DISTINCT tdee.grt_wr_grouping_analyst,
trunc(tdee.errupdateddate)
AS errupdateddate
FROM tbl_dom_exp_error tdee
WHERE SUBSTR (tdee.recpnm_pkg_seq, 13, 2) = 'CL'
AND SUBSTR (tdee.recpnm_pkg_seq, 20, LENGTH(0)) = 0
AND tdee.trkngnbr IS NULL
AND ( ( tdee.grt_comment IS NOT NULL
AND tdee.errortype IS NOT NULL
AND (tdee.errormsg IS NOT NULL OR tdee.errormsg = ''))
OR (tdee.grt_comment IS NOT NULL AND tdee.errortype IS NOT NULL
AND (tdee.comments_vchar IS NOT NULL OR tdee.comments_vchar = '')))
GROUP BY tdee.errupdateddate,tdee.grt_wr_grouping_analyst
ORDER BY tdee.grt_wr_grouping_analyst
Image 1
This is what I want with number of records per date
GRT_WR_GROUPING_ANALYST ERRUPDATEDDATE
110038 4/9/2010
285717 4/7/2010
285717 4/8/2010
285717 4/9/2010
285717 4/13/2010
459180 4/7/2010
459180 4/8/2010
459180 4/9/2010
Image 2
What I get when add count(*) in select
GRT_WR_GROUPING_ANALYST ERRUPDATEDDATE CNTME
110038 4/9/2010 2
285717 4/7/2010 1
285717 4/7/2010 2
285717 4/7/2010 3
285717 4/7/2010 4
285717 4/7/2010 6
285717 4/8/2010 1
285717 4/8/2010 2
285717 4/8/2010 3
285717 4/8/2010 4
285717 4/8/2010 5
285717 4/8/2010 7
285717 4/8/2010 8
285717 4/8/2010 14
285717 4/8/2010 15
285717 4/8/2010 16
285717 4/8/2010 20
285717 4/8/2010 28
285717 4/8/2010 29
285717 4/8/2010 32
285717 4/8/2010 34
285717 4/8/2010 36
285717 4/8/2010 40
285717 4/8/2010 41
285717 4/8/2010 43
285717 4/9/2010 1
285717 4/9/2010 2
285717 4/9/2010 3
285717 4/9/2010 4
285717 4/9/2010 10
285717 4/9/2010 15
285717 4/9/2010 17
285717 4/9/2010 19
285717 4/9/2010 21
285717 4/9/2010 25
285717 4/9/2010 27
285717 4/9/2010 28
285717 4/9/2010 32
285717 4/9/2010 35
285717 4/9/2010 40
285717 4/13/2010 1
285717 4/13/2010 20
459180 4/7/2010 1
459180 4/7/2010 3
459180 4/8/2010 1
459180 4/8/2010 2
459180 4/9/2010 1
Hope this is clear
Thanks in advance
Louie