Cursor to take sum of counts
Hi,
I need to take count of some records.
i have file_id from 1000 to 1350
MemberIds for each File_id is 2300. E.g :- 1001 file will have Members from *1001*FILE00001 to *1001*FILE02300.
1002 file will have members from *1002*FILE00001 to *1002*FILE02300
i need to take count of MemberIds for all the files . that means count = 350 FILES * 2300Members.Since the bold part above(1001 and 1002) is changing everytime,we need to prepare a procedure to take count.
I am stuck as I am new to cursor.Kindly help me.
Thanks
Hi,
user10698496 wrote:
Hi,
I need to take count of some records.
i have file_id from 1000 to 1350
MemberIds for each File_id is 2300. E.g :- 1001 file will have Members from *1001*FILE00001 to *1001*FILE02300.
1002 file will have members from *1002*FILE00001 to *1002*FILE02300
i need to take count of MemberIds for all the files . that means count = 350 FILES * 2300Members.Since the bold part above(1001 and 1002) is changing everytime,we need to prepare a procedure to take count.Sorry, I don't understand.
Why do you need a procedure? Why not just a query, such as:
SELECT SUBSTR (member_col, 1, 4) AS file_id
, COUNT (member_col) AS cnt -- or maybe COUNT (DISTINCT member_col)
FROM table_x
GROUP BY SUBSTR (member_col, 1, 4);
I am stuck as I am new to cursor.Kindly help me.What role does a cursor play in this problem?
Are you saying you already have a cursor, and you need to count as you loop through the rows? If so, you can use 2 variables, one to remember which file_id you're currently counting, and the other with the count. When the file_id from the current row no longer matches the file_id variable, change it, and reset the count to 0. You could also usie the analytic COUNT function to include the total count in each row of the data returned.
Whenever you have a question, post a little sample data (CREATE TABLE and INSERT statements), and the results you want from that data.
Explain how you get those results from that data.
Always say which version of Oracle you're using.
Similar Messages
-
DIFFERENCE BETWEEN SUM AND COUNT IN SQL
DIFFERENCE BETWEEN SUM AND COUNT IN SQL
WHAT IS THE DIFFERENCE VERIFY IN DETAIL/21031980, I suggest you upgrade your computer sothat you can access google.
lol.
wtfpwnd.Google is also helpful for understanding the strange
acronyms that show up around here lately (yes, I did
find and understand this one). :-)Haha, sorry!
It's the inner-gamer in me rearing its ugly head...
:-) -
Rolling averages/sums for counts
I am a new user (business objects 12 relaease 2)
I would like to build a report in web intelligence displaying the average count of the number of records per day, where the average is calculated for a rolling window of days.
For example a rolling daily average count of records using a 3 day window would be caluculated by:
Summing the counts of records for the last three days and dividing by 3
I would like to include this rolling average in a table for a specified of time period, say the last 30 days. My table would have two rows the top row would be the date and would hgave 30 entries, inbe for each of the previous 30 days, The scond row would have the 3 day rolling average for each of the 30 days. This table format will also allow me to graph the table
An additional problem arises becasue there are some dates that have no data. I need to include those dates, but Web Intelligence won't display them. Is there a way of displaying dates with no values in the table?John Berezowski,
In response to your question: "An additional problem arises becasue there are some dates that have no data. I need to include those dates, but Web Intelligence won't display them. Is there a way of displaying dates with no values in the table?"
The solution is to build a "backend table" in your data base that has all of the applicable dates accounted for. Then modify your universe by linking this new table to your pre-existing table and process as a left outer join (providing that this new table is on the "left" side, otherwise a full outer join will suffice due to the manner that you've built your table).
A technique you can apply to the other columns used in your original table would be the use of the "coalesce" function to avoid nulls and transform unjoined values to spaces (or zero or some other value for integers).
thanks,
John -
SUM and count next to each other
SUM and count next to each other
I would like to have the measurements SUM and COUNT cells being next to each other.
As a default it shows up like this:
.......SUM............. COUNT
......RegionA RegionB RegionA RegionB
2000..... $..... $..... nn..... nn
2001..... $..... $..... nn..... nn
2002..... $..... $..... nn..... nn
Can I change this somehow to:
......RegionA.....RegionB
......SUM COUNT ...SUM COUNT
2000...$....nn......$... nn
2001...$....nn......$... nn
2002...$....nn......$... nn
thnx
EndreSelect your axis "Region" and move it over (i.e. on top of) your data points (SUM, COUNT, etc.).
-
I have the below query, and i need to sum up the stuff here...
so basically, i want TO SUM UP count(*) to be 6046 for " I " in operation$ column
and data to be 07/09/2009...
please look here fore results from above query
http://img118.imageshack.us/img118/4568/result.png
my end results should be something like
OPERATION$ count(*) to_char(timestamp$,'MM/DD/YYYY)
I 6046 07/09/2009
UN 19685 07/09/2009
UU 8384 07/09/2009
I ##### 07/08/2009
UN ##### 07/08/2009
UU ##### 07/08/2009
AND SO ON....
Edited by: S2K on Jul 12, 2009 7:52 PMTry this
Not tested
WITH qry
AS (SELECT operation$,
Count(* ) kount,
To_char(timestamp$,'MM/DD/YYYY') dt
FROM cbio.cdc_aliquot
WHERE operation$ != 'un'
GROUP BY operation$,
To_char(timestamp$,'MM/DD/YYYY')
UNION ALL
SELECT operation$,
Count(* ),
To_char(timestamp$,'MM/DD/YYYY')
FROM cbio.cdc_aliquot_user
WHERE operation$ != 'un'
GROUP BY operation$,
To_char(timestamp$,'MM/DD/YYYY')
UNION ALL
SELECT operation$,
Count(* ),
To_char(timestamp$,'MM/DD/YYYY')
FROM cbio.cdc_result
WHERE operation$ != 'un'
GROUP BY operation$,
To_char(timestamp$,'MM/DD/YYYY')
UNION ALL
SELECT operation$,
Count(* ),
To_char(timestamp$,'MM/DD/YYYY')
FROM cbio.cdc_result_user
WHERE operation$ != 'un'
GROUP BY operation$,
To_char(timestamp$,'MM/DD/YYYY'))
SELECT Sum(kount)
FROM qry
WHERE operation$ = 'I'SS -
Sum(sales) count for month year and week
I have sales table : pord_id number, sale_date date
my question: a) i need to populate sum of sales for week ie., from today to 7 days example 20-MAY-2007 to 27-MAY-2007
b) sum of sales for month of MAY this year 2007
c) sum of sales for 20-MAY-2006 last, only day
Please help me with this query.. URGENTThis..?
sql>select * from sale;
PROD_ID SALES_DATE
2 02-MAY-07
3 03-MAY-07
4 04-MAY-07
5 05-MAY-07
7 07-MAY-07
8 08-MAY-07
10 10-MAY-07
11 11-MAY-07
12 12-MAY-07
13 13-MAY-07
14 14-MAY-07
15 15-MAY-07
16 16-MAY-07
17 17-MAY-07
18 18-MAY-07
19 19-MAY-07
20 20-MAY-07
22 22-MAY-07
23 23-MAY-07
24 24-MAY-07
26 26-MAY-07
27 27-MAY-07
28 28-MAY-07
29 29-MAY-07
30 30-MAY-07
25 rows selected.
sql>
select sum(case sales_date when trunc(sysdate) then 1 else 0 end) day_sum,
sum(case when sales_date between sysdate and sysdate+7 then 1 else 0 end) week_sum,
sum(case when sales_date between trunc(sysdate,'month') and last_day(sysdate) then 1 else 0 end) month_sum,
count(*) year_sum
from sale
where to_char(sales_date,'yyyy') = to_char(sysdate,'yyyy');
DAY_SUM WEEK_SUM MONTH_SUM YEAR_SUM
1 5 25 25
Message was edited by:
jeneesh
Note: Truncated dates were inserted in the table -
How to SUM two count(*) values in a single sql tatement?
How can I get a single SQL statement to sum two values from a count(*)
I want something like this:
SELECT COUNT(*) FROM MYTABLE
UNION
SELECT COUNT(*) FROM MYOTHERTABLE;
but instead of getting
111
222
I want to see the sum of the two values.
333can such a thing be done with one statement. I know I can do stuff inside a BEGIN END and have vars but wonder if there is simple single statement solution.
Thanks in advance,
David MillerSQL> select count(*) from user_indexes;
COUNT(*)
30
SQL> select count(*) from user_tables;
COUNT(*)
43
SQL> select (select count(*) from user_indexes) + (select count(*) from user_tables)
2 from dual;
(SELECTCOUNT(*)FROMUSER_INDEXES)+(SELECTCOUNT(*)FROMUSER_TABLES)
73 -
Hello everyone,
I am using the following MDX query on one of my SSRS report.
SELECT NON EMPTY { [Measures].[Days Outstanding], [Measures].[Amt] } ON COLUMNS,
NON EMPTY { ([Customer].[Customer].[Customer Key].ALLMEMBERS) }
HAVING [Measures].[ Days Outstanding] > 60
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM ( SELECT ( STRTOSET(@Location, CONSTRAINED)) ON COLUMNS
FROM ( SELECT ( {[Date].[Fiscal Period].&[2014-06]}) ON COLUMNS
FROM [Model]))
Over here, the data is being filtered always for current month and for a location that is being selected by user from a report selection parameter.
I would like to get the count of total no. of customers and sum of the amount measure.
When I am using them in calculated members it gives incorrect values. It considers all records (ignores the sub-select statements) instead of only the records of current month and selected location.
I also tried with EXISTING keyword in calculated members but there is not difference in output. Finally, I manage the same at SSRS level.
Can anybody please advise what are the ways to get the required sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension?
Also, does it make any difference if I manage it as SSRS level and not at MDX query level?
Any help would be much appreciated.
Thanks, Ankit Shah
Inkey Solutions, India.
Microsoft Certified Business Management Solutions Professionals
http://www.inkeysolutions.com/MicrosoftDynamicsCRM.htmlCan anybody please advise what are the ways to get the required sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension?
Also, does it make any difference if I manage it as SSRS level and not at MDX query level?
Hi Ankit,
We can use SUM function and COUNT function to sum of [Measures].[Amt] and count of [Customer].[Customer].[Customer Key].ALLMEMBERS dimension. Here is a sample query for you reference.
WITH MEMBER [measures].[SumValue] AS
SUM([Customer].[Customer].ALLMEMBERS,[Measures].[Internet Sales Amount])
MEMBER [measures].[CountValue] AS
COUNT([Customer].[Customer].ALLMEMBERS)
MEMBER [Measures].[DimensionName] AS [Customer].NAME
SELECT {[Measures].[DimensionName],[measures].[SumValue],[measures].[CountValue]} ON 0
FROM [Adventure Works]
Besides, you ask that does it make any difference if I manage it as SSRS level and not at MDX query level. I don't thinks it will make much difference. The total time to generate a reporting server report (RDL) can be divided into 3 elements:Time to retrieve
the data (TimeDataRetrieval);Time to process the report (TimeProcessing);Time to render the report (TimeRendering). If you manage it on MDX query level, then the TimeDataRetrieval might a little longer. If you manage it on report level, then the TimeProcessing
or TimeRendering time might a little longer. You can test it on you report with following query:
SELECT Itempath, TimeStart,TimeDataRetrieval + TimeProcessing + TimeRendering as [total time],
TimeDataRetrieval, TimeProcessing, TimeRendering, ByteCount, [RowCount],Source
FROM ExecutionLog3
WHERE itempath like '%reportname'
Regards,
Charlie Liao
TechNet Community Support -
Error when trying to use SUM with COUNT
I have the following query which works fine. However, I need to add another column that is the SUM of the firs column ("OPEN"). I have also included that query but I cannot get it to work. Any help would be appreciated.
SELECT
TO_CHAR(TRUNC(R.RAD_SUBMIT_DATE, 'MM'), 'yyyy-mm') as THISDATE,
COUNT(decode(A.STATE_DESC, 'Approved', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Concept', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'New', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Pending', A.STATE_DESC))
) as OPEN,
COUNT(decode(A.STATE_DESC, 'Approved', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Concept', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'New', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Pending', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Completed', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Rejected', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Rescinded', A.STATE_DESC))
) as TOTAL
FROM RAW_APP_DATA R, APP_STATE A
WHERE R.RAD_STATUS = A.STATE_ID
AND (R.RAD_SUBMIT_DATE BETWEEN '01-AUG-02' AND '31-JAN-04')
GROUP BY TO_CHAR(TRUNC(R.RAD_SUBMIT_DATE, 'MM'), 'yyyy-mm')
ORDER BY TO_CHAR(TRUNC(R.RAD_SUBMIT_DATE, 'MM'), 'yyyy-mm')
(RESULTS)
THISDAT OPEN TOTAL
2002-08 1 37
2002-09 0 40
2002-10 0 33
2002-11 1 25
2002-12 2 22
2003-01 3 25
2003-02 4 101
2003-03 5 99
2003-04 5 85
2003-05 3 69
2003-06 17 90
2003-07 6 57
2003-08 26 89
2003-09 43 117
2003-10 59 110
2003-11 47 67
2003-12 75 80
2004-01 9 9
18 rows selected.
SECOND QUERY (DOES NOT WORK)
SELECT
TO_CHAR(TRUNC(R.RAD_SUBMIT_DATE, 'MM'), 'yyyy-mm') as THISDATE,
COUNT(decode(A.STATE_DESC, 'Approved', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Concept', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'New', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Pending', A.STATE_DESC))
) as OPEN,
COUNT(decode(A.STATE_DESC, 'Approved', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Concept', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'New', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Pending', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Completed', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Rejected', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Rescinded', A.STATE_DESC))
) as TOTAL,
SUM(
COUNT(decode(A.STATE_DESC, 'Approved', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Concept', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'New', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Pending', A.STATE_DESC))
)) as "OPEN TOTAL"
FROM RAW_APP_DATA R, APP_STATE A
WHERE R.RAD_STATUS = A.STATE_ID
AND (R.RAD_SUBMIT_DATE BETWEEN '01-AUG-02' AND '31-JAN-04')
GROUP BY TO_CHAR(TRUNC(R.RAD_SUBMIT_DATE, 'MM'), 'yyyy-mm')
ORDER BY TO_CHAR(TRUNC(R.RAD_SUBMIT_DATE, 'MM'), 'yyyy-mm')
DESIRED RESULT SET
THISDAT OPEN TOTAL TOTAL OPEN
2002-08 1 37 1
2002-09 0 40 1
2002-10 0 33 1
2002-11 1 25 2
2002-12 2 22 4
2003-01 3 25 7
2003-02 4 101 11
2003-03 5 99 16
2003-04 5 85 21You are right those are group functions not aggregate. However, if I try to group by with the group functions I get an error (see code).
SELECT
TO_CHAR(TRUNC(R.RAD_SUBMIT_DATE, 'MM'), 'yyyy-mm') as THISDATE,
COUNT(decode(A.STATE_DESC, 'Approved', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Concept', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'New', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Pending', A.STATE_DESC))
) as OPEN,
COUNT(decode(A.STATE_DESC, 'Approved', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Concept', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'New', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Pending', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Completed', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Rejected', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Rescinded', A.STATE_DESC))
) as TOTAL,
SUM(
COUNT(decode(A.STATE_DESC, 'Approved', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Concept', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'New', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Pending', A.STATE_DESC))
)) as "OPEN TOTAL"
FROM RAW_APP_DATA R, APP_STATE A
WHERE R.RAD_STATUS = A.STATE_ID
AND (R.RAD_SUBMIT_DATE BETWEEN '01-AUG-02' AND '31-JAN-04')
GROUP BY
TO_CHAR(TRUNC(R.RAD_SUBMIT_DATE, 'MM'), 'yyyy-mm'),
COUNT(decode(A.STATE_DESC, 'Approved', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Concept', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'New', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Pending', A.STATE_DESC))
COUNT(decode(A.STATE_DESC, 'Approved', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Concept', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'New', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Pending', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Completed', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Rejected', A.STATE_DESC)) +
COUNT(decode(A.STATE_DESC, 'Rescinded', A.STATE_DESC))
ORDER BY TO_CHAR(TRUNC(R.RAD_SUBMIT_DATE, 'MM'), 'yyyy-mm')
ORA-00934: group function is not allowed here
Do I group by the columns individually? -
Use of SUM and COUNT with GROUP BY
All,
I have a set like below:
State DOB StartDt EndDt Desc Category MemberID SubID Code
NC 2003-01-30 2014-01-01 2014-01-31 Child B 123456 2 38
NC 2003-01-30 2014-01-01 2014-01-31 Child B 123456 2 39
NC 2003-01-30 2014-02-01 2014-05-31 Child B 123456 2 38
NC 2003-01-30 2014-02-01 2014-05-31 Child B 123456 2 39
NC 2003-01-30 2014-06-01 2014-07-31 Child B 123456 2 38
NC 2003-01-30 2014-06-01 2014-07-31 Child B 123456 2 39
NC 2014-01-17 2014-01-01 2014-07-31 Infant S 456789 1 49
NC 2014-02-04 2014-02-01 2014-07-31 Infant S 246376 3 49
-- MemberID and SubID identify 1 member
-- Member 123456 has 2 distinct "Code" i.e. 38,39 but each code has different "StartDt" and "EndDt"
-- Expected Result
State Desc Category CountOfDistinctCode TotalMonthsEnrolled
NC Child B 2 (38 and 39 for same member) 7 months (1 + 4 + 2) (Difference between StartDt and EndDt:1 (1/31/2014 - 1/1/2014) + 4 (5/31/2014 - 2/1/2014).. )
NC Infant S 2 (Same code 49 but different member) 13 months (7+6) (7/31/2014 - 1/1/2014 = 7 months + 7/31/2014 - 2/1/2014 = 6 months)
I tried doing a count of distinct Code and the summing up the member months, grouped by State, Desc, Category, but I am not able to get 2 and 7 for child, it somehow calculates Months as 14 (7+7). Please let me know what you guys suggest.OK, so we need a different approach. We need a table of numbers, a concept that I discuss here:
http://www.sommarskog.se/arrays-in-sql-2005.html#numbersasconcept
(Only read down to the next header.)
We join the numbers to temp table with BETWEEN over the numbers. Then we count the distinct combination of member ID and number.
We also need to make an adjustment how to build the string for the DISTINCT. I initially assumed that your columns were integer, why I used str() which produces a right-adjusted fixed-length string of 10 characters. (The default, you can specify a different
width as the second parameter.) But str() expects a float value as input, and will fail if for instance member id would be non-numeric. We cannot just concatenate the strings, since in that case (MemberID, SubID) = ('12345', '61') would be
the same as ('123456', '1'). So we must convert to char to get fixed length. All that said, and some more test data added, here is a solution:
CREATE TABLE #Test
[State] CHAR(2),
DOB DATE,
StartDt DATE,
EndDt DATE,
[Desc] VARCHAR(8),
Category CHAR(1),
MemberID VARCHAR(10),
SubID VARCHAR(2),
Code VARCHAR(5)
INSERT INTO #Test
VALUES
('NC', '20130130', '20140101', '20140120', 'Child', 'B', '123456', '2', '38'),
('NC', '20130130', '20140121', '20140131', 'Child', 'B', '123456', '2', '39'),
('NC', '20130130', '20140201', '20140531', 'Child', 'B', '123456', '2', '38'),
('NC', '20130130', '20140401', '20140613', 'Child', 'B', '123456', '2', '39'),
('NC', '20130130', '20140601', '20140731', 'Child', 'B', '123456', '2', '38'),
('NC', '20130130', '20140614', '20140731', 'Child', 'B', '123456', '2', '39'),
('NC', '20130129', '20140601', '20140731', 'Child', 'B', '9123456', '1', '38'),
('NC', '20130129', '20140614', '20140831', 'Child', 'B', '9123456', '1', '39'),
('NC', '20140117', '20140101', '20140731', 'Infant', 'S', '456789', '1', '49'),
('NC', '20140204', '20140201', '20140731', 'Infant', 'S', '246376', '3', '49')
SELECT * FROM #Test ORDER BY MemberID, StartDt, EndDt
SELECT
[State]
, [Desc]
, Category
, COUNT(DISTINCT convert(char(10), MemberID) +
convert(char(2), SubID) +
convert(char(5), Code)) AS TotalCnt
, COUNT(DISTINCT convert(char(10), MemberID) +
convert(char(2), SubID) +
str(N.Number)) AS CalMonths
FROM #Test t
JOIN Numbers N ON N.Number BETWEEN
datediff(MONTH, '19000101', t.StartDt) AND
datediff(MONTH, '19000101', t.EndDt)
GROUP BY [State], [Desc], Category
go
DROP TABLE #Test
Erland Sommarskog, SQL Server MVP, [email protected] -
Is there a way to sum a distinct count?
I have a distinct count placed on GF2 and need the Sum of the Distinct count of GF1.
Is this possible?
Thanks for any help and suggestions,
JenHi Jen,
Try this:
1) Create a formula on the Group Footer 2:
WhilePringtingRecords;
Numbervar dc;
dc := dc + distinctcount({database field}, {group});
2) Create another formula to display the sum and place this on the GF1:
WhilePringtingRecords;
Numbervar dc;
3) Create a reset formula and place it on the GH1:
WhilePringtingRecords;
Numbervar dc := 0;
-Abhilash -
SUM the COUNT RESULTS from 2 Tables
If I have 2 seperate queries how can I sum the results of them
select count(*) from tableA;
select count(*) from tableB;
MAXIMO@tarml > select count(*) from tableA;
COUNT(*)
500
MAXIMO@tarml > select count(*) from tableB;
COUNT(*)
600
MAXIMO@tarml > I want a query that gets me the 1100?
I know people in here will know a simple solution that I can not find on the web?
Thanks in advance again as always...
MillerYou should have read your given link more closely: You would have found
select ( select count(*) from Table1 )
+ ( select count(*) from Table2 )
as total_rows
from my_one_row_table --<--- replace with dual -
How to sum the count results?
Hi,
I have this query:
SELECT SUM (cnt) FROM
select max(timestamp), min(timestamp), count(1) as cnt from table1
union
select max(timestamp2), min(timestamp2), count(1) from table2
It display sum of all count results. But how to display each result from query and sum result at the end?
Best.OK, thanks, that helps a lot. Though if you could put {noformat}{noformat} before and after your code snippets that would help further.
So you basically want a total at the end:WITH test_data AS (
SELECT 1 col1, TO_DATE('16-AUG-08', 'DD-MON-YY') max_ts, TO_DATE('16-AUG-08', 'DD-MON-YY') min_ts, 1000 cnt FROM DUAL UNION ALL
SELECT 1, TO_DATE('31-OCT-08', 'DD-MON-YY'), TO_DATE('31-OCT-08', 'DD-MON-YY'), 1000 FROM DUAL UNION ALL
SELECT 1, TO_DATE('10-FEB-09', 'DD-MON-YY'), TO_DATE('01-JAN-01', 'DD-MON-YY'),422 FROM DUAL UNION ALL
SELECT 1, TO_DATE('20-FEB-09', 'DD-MON-YY'), TO_DATE('20-FEB-09', 'DD-MON-YY'),1000 FROM DUAL UNION ALL
SELECT 1, TO_DATE('20-FEB-09', 'DD-MON-YY'), TO_DATE('20-FEB-09', 'DD-MON-YY'),14825 FROM DUAL UNION ALL
SELECT 1, TO_DATE('27-FEB-09', 'DD-MON-YY'), TO_DATE('27-FEB-09', 'DD-MON-YY'),1000 FROM DUAL UNION ALL
SELECT 1, TO_DATE('28-FEB-09', 'DD-MON-YY'), TO_DATE('26-FEB-09', 'DD-MON-YY'),1000 FROM DUAL UNION ALL
SELECT 1, TO_DATE('01-MAR-09', 'DD-MON-YY'), TO_DATE('01-MAR-09', 'DD-MON-YY'),1000 FROM DUAL UNION ALL
SELECT 1, TO_DATE('05-MAR-09', 'DD-MON-YY'), TO_DATE('16-AUG-08', 'DD-MON-YY'), 5150 FROM DUAL UNION ALL
SELECT 1, TO_DATE('27-APR-09', 'DD-MON-YY'), TO_DATE('30-OCT-08', 'DD-MON-YY'),8733 FROM DUAL UNION ALL
SELECT 1, TO_DATE('27-APR-09', 'DD-MON-YY'), TO_DATE('20-FEB-09', 'DD-MON-YY'),10000 FROM DUAL)
-- end test data
SELECT col1, max_ts, min_ts, sum(cnt) total_cnt
FROM test_data
GROUP BY ROLLUP((col1, max_ts, min_ts));
1 16-AUG-08 16-AUG-08 1000
1 31-OCT-08 31-OCT-08 1000
1 10-FEB-09 01-JAN-01 422
1 20-FEB-09 20-FEB-09 15825
1 27-FEB-09 27-FEB-09 1000
1 28-FEB-09 26-FEB-09 1000
1 01-MAR-09 01-MAR-09 1000
1 05-MAR-09 16-AUG-08 5150
1 27-APR-09 30-OCT-08 8733
1 27-APR-09 20-FEB-09 10000
45130
11 rows selected. -
Hi all!
I am trying to grab a total of the COUNTS and SUM them together. I am trying to build a chart with graphics builder, but alas, that software has a 2000 character limit for its queries, so the inline view approach did not work. Here is my query:
SELECT
to_char(to_date(papf.attribute1, 'YYYYMMDD'), 'YYYY') Base_Entry_Year,
count(*)
-- SUM(count(*)) does not work
FROM
per_all_assignments_f paaf,
per_all_people_f papf,
per_jobs pj,
per_job_definitions pjd
WHERE
papf.person_id = paaf.person_id
AND paaf.ass_attribute14 IS NOT NULL
AND to_char(to_date(papf.attribute1, 'YYYYMMDD'), 'YYYY') IS NOT NULL
AND (papf.employee_number IS NOT NULL OR papf.person_type_id = 3)
AND paaf.job_id = pj.job_id
AND pj.job_definition_id = pjd.job_definition_id
AND pjd.segment1 NOT IN ('09140018', '09340006', '09140037', '09140051', '09140052', '09140054', '09140055')
GROUP BY
to_char(to_date(papf.attribute1, 'YYYYMMDD'), 'YYYY')
ORDER BY
to_char(to_date(papf.attribute1, 'YYYYMMDD'), 'YYYY')
Any ideas on how I can accomplish this? Thanks!
SteveHi,
I ran two different queries:
1.
select KeyCol, count(*), Sum(count(*)) over ()
from Test t
group by t.KeyCol ;
Result:
KEYCOL COUNT SUM(COUNT(*))OVER()
1 DHP 398 5505
2 FIH 1 5505
3 FIN 2971 5505
4 FLP 5 5505
5 HTBC 1 5505
6 Z99 22 5505
7 2107 55052.
select KeyCol, count(*), count(*) over ()
from test t
group by KeyCol;
Result:
KEYCOL COUNT COUNT(*)OVER()
1 DHP 398 7
2 FIH 1 7
3 FIN 2971 7
4 FLP 5 7
5 HTBC 1 7
6 Z99 22 7
7 2107 7This shows that both queries are not equivalent.
Thanks,
Dharmesh Patel -
Hi
I am looking for a sum of status count by group of 5 min from given date-time.
I have table table1 with columns update_datetime date, status char(1)
Can any one suggest a solution for it? Thanks in advance.
I have a query but want to modify it to get the sum of status group by 5 min -
SELECT update_datetime , decode(status,'1','SUBMITTED') status,COUNT (1)
FROM test1
WHERE to_char(update_datetime, 'dd-mon-yyyy hh24:mi:ss') >= '24-jan-2010 14:00:00'
and to_char(update_datetime, 'dd-mon-yyyy hh24:mi:ss') < '24-jan-2010 14:16:00'
AND status = '1'
GROUP BY update_datetime, status
order by update_datetime;
UPDATE_DATETIME STATUS
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:00:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:01:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:02:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:03:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:04:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:05:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:06:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:07:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:08:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:09:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:10:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:11:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:12:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:13:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:14:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:15:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
24/01/2010 14:16:00 1
Edited by: SDD on Feb 3, 2010 11:18 AMSomething like this:
SQL> WITH subq_times AS
2 (SELECT SYSDATE + ROWNUM/(24*60) dt
3 FROM dual
4 CONNECT BY ROWNUM <= 20)
5 SELECT dt, TRUNC(dt) + TRUNC(TO_CHAR(dt,'SSSSS')/300)/12/24 group_by_me
6 FROM subq_times
7 ORDER BY dt;
DT GROUP_BY_ME
03/02/2010 11:32:53 03/02/2010 11:30:00
03/02/2010 11:33:53 03/02/2010 11:30:00
03/02/2010 11:34:53 03/02/2010 11:30:00
03/02/2010 11:35:53 03/02/2010 11:35:00
03/02/2010 11:36:53 03/02/2010 11:35:00
03/02/2010 11:37:53 03/02/2010 11:35:00
03/02/2010 11:38:53 03/02/2010 11:35:00
03/02/2010 11:39:53 03/02/2010 11:35:00
03/02/2010 11:40:53 03/02/2010 11:40:00
03/02/2010 11:41:53 03/02/2010 11:40:00
03/02/2010 11:42:53 03/02/2010 11:40:00
03/02/2010 11:43:53 03/02/2010 11:40:00
03/02/2010 11:44:53 03/02/2010 11:40:00
03/02/2010 11:45:53 03/02/2010 11:45:00
03/02/2010 11:46:53 03/02/2010 11:45:00
03/02/2010 11:47:53 03/02/2010 11:45:00
03/02/2010 11:48:53 03/02/2010 11:45:00
03/02/2010 11:49:53 03/02/2010 11:45:00
03/02/2010 11:50:53 03/02/2010 11:50:00
03/02/2010 11:51:53 03/02/2010 11:50:00
20 rows selected.
SQL> WITH subq_times AS
2 (SELECT SYSDATE + ROWNUM/(24*60) dt
3 FROM dual
4 CONNECT BY ROWNUM <= 20)
5 SELECT TRUNC(dt) + TRUNC(TO_CHAR(dt,'SSSSS')/300)/12/24 group_by_me
6 , COUNT(*)
7 FROM subq_times
8 GROUP by TRUNC(dt) + TRUNC(TO_CHAR(dt,'SSSSS')/300)/12/24
9 ORDER BY 1;
GROUP_BY_ME COUNT(*)
03/02/2010 11:30:00 2
03/02/2010 11:35:00 5
03/02/2010 11:40:00 5
03/02/2010 11:45:00 5
03/02/2010 11:50:00 3
SQL>
Maybe you are looking for
-
I created a report in CR 2008 and saved the data with the report. Upon moving the report to a Web App, I discovered that it always appears with the saved data. I went back to my development box and saved the report without data. I then put it back
-
My internal cd/dvd drive has recently broke. Does anyone know of a decent external drive that will load software, and cd's. Dvd's not as important, nor is the recording option. Thank you for all your help.
-
Update Migration Assistant and DVD/CD Sharing
Hi everyone, I'm just updating the Migration Assistant by Auto-Update and the Installation takes pretty long. It's been installing for over an hour now, and it's stuck at configuring installation. Time Machine does not do any backups either right now
-
Problems with exec() in Servlet
Hi All, In my project i have used exec()in servlets to get the ouput from the c- program.I am using linux 8.0 and the server is tomcat-4.1.24.so that i try this following code:- import java.io.*; import java.util.*; import javax.servlet.*; import jav
-
Need alternative to Dreamweaver CC
I've been using DW for many years now and building great dynamic web sites for clients and employers. Now, with DW CC, we loose all those tools for building dynamic web sites! Yes, I know that I can get those depricated tools back for a little while