Getting total count instead particular count
Hi all,
Need out put in the report , i made relation (link) b/w customer_id's
customer_id:1234
customer name:Vision Tech
order no order_name Cost
1000 ABC 1000
1001 CCC 2000
Total Order: 2 Total Cost: 3000
customer_id:1000
customer name:Tech
order no order_name Cost
400 DDD 300
4001 EEE 400
Total Order: 2 Total Cost: 700
But getting Total Order: 4 Total Cost: 3700 for both
Hi,
I need the as below out put
Suppose
deptno 10
dname ABC
empno ename sal deptno
100 aaa 100 10
101 bbb 100 10
Total Eployees: 2 Total Sal: 200
deptno 20
dname ABC
empno ename sal deptno
110 ccc 100 20
121 ddd 100 20
161 eee 100 20
Total Eployees: 3 Total Sal: 300
But i am getting as below
deptno 10
dname ABC
empno ename sal deptno
100 aaa 100 10
101 bbb 100 10
Total Eployees: 4 Total Sal: 500
deptno 20
dname ABC
empno ename sal deptno
110 ccc 100 20
121 ddd 100 20
161 eee 100 20
Total Eployees: 4 Total Sal: 500
I am creating Summry columns for "Total Employees" and "Total Sal"
Total Employees
Function:Count
Source: Empno
Reset At:Report
Total Sal
Function:SUM
Source:SAL
Reset At:Report
Similar Messages
-
Need to get total count of a column in the given query
Hi,
I have the following query for which i need a total count of distinct concatenated_address. I am trying to use count(distinct adv.concatenated_address) in the below query but because of the group by it does not give me the expected result.
I am not reusing the same query, in my program again, to get the count as it would affect the performance. This query takes really long to execute and so is there a way to incorporate the count in this single query itself without having to use it twice.
SELECT DISTINCT (acv.customer_name||','||
acv.customer_number||','||
REPLACE(adv.concatenated_address, ',', ' ')||','||
adv.postal_code||','||
rct.interface_header_attribute1||','||
rct.interface_header_attribute6||','||
rct.creation_date||','||
rct.trx_date||','||
aps.due_date ||','||
SUM(aps.amount_due_original)||','||
SUM(aps.amount_due_remaining) ||','||
rct.printing_count ||','||
TO_DATE(rct.printing_last_printed)||','||
TO_DATE(rct.printing_original_date)||',') str
,acv.customer_id
,REPLACE(adv.concatenated_address, ',', ' ') address
FROM ar_customers_v acv
,ar_addresses_v adv
,hz_cust_site_uses hcsu
,ra_customer_trx rct
,ar_payment_schedules aps
WHERE adv.customer_id = acv.customer_id
AND hcsu.cust_acct_site_id = adv.address_id
AND hcsu.site_use_code = 'BILL_TO'
AND rct.bill_to_customer_id = acv.customer_id
AND rct.bill_to_site_use_id = hcsu.site_use_id
AND aps.customer_trx_id = rct.customer_trx_id
GROUP BY acv.customer_name
,acv.customer_number
,adv.concatenated_address
,adv.postal_code
,rct.interface_header_attribute1
,rct.interface_header_attribute6
,rct.creation_date
,rct.trx_date
,aps.due_date
,rct.printing_count
,TO_DATE(rct.printing_last_printed)
,TO_DATE(rct.printing_original_date)
,acv.customer_id
ORDER BY acv.customer_id
,REPLACE(adv.concatenated_address, ',', ' ')
Thank youtry this please
SELECT COUNT(str),customer_id
FROM
(SELECT DISTINCT (acv.customer_name||','||
acv.customer_number||','||
REPLACE(adv.concatenated_address, ',', ' ')||','||
adv.postal_code||','||
rct.interface_header_attribute1||','||
rct.interface_header_attribute6||','||
rct.creation_date||','||
RCT.TRX_DATE||','||
aps.due_date ||','||
SUM(aps.amount_due_original)||','||
SUM(aps.amount_due_remaining) ||','||
rct.printing_count ||','||
TO_DATE(rct.printing_last_printed)||','||
TO_DATE(rct.printing_original_date)||',') str
,acv.customer_id
,REPLACE(adv.concatenated_address, ',', ' ') address
FROM ar_customers_v acv
,ar_addresses_v adv
,hz_cust_site_uses hcsu
,ra_customer_trx rct
,ar_payment_schedules aps
WHERE adv.customer_id = acv.customer_id
AND hcsu.cust_acct_site_id = adv.address_id
AND hcsu.site_use_code = 'BILL_TO'
AND rct.bill_to_customer_id = acv.customer_id
AND rct.bill_to_site_use_id = hcsu.site_use_id
AND aps.customer_trx_id = rct.customer_trx_id
GROUP BY acv.customer_name
,acv.customer_number
,adv.concatenated_address
,adv.postal_code
,rct.interface_header_attribute1
,rct.interface_header_attribute6
,rct.creation_date
,rct.trx_date
,aps.due_date
,rct.printing_count
,TO_DATE(rct.printing_last_printed)
,TO_DATE(RCT.PRINTING_ORIGINAL_DATE)
,ACV.CUSTOMER_ID) -
Query to get total counts in the given scenario
Hi,
I am using Oracle 10g
I have a table A with following data
AgId Trm CD S
1000 100010 12-JAN A
1000 100019 20-MAR A
1000 100019 20-JUL D
1001 100011 25-JAN A
1001 100011 20-FEB D
1001 100011 23-MAR A
1001 100012 31-JAN A
1002 100013 14-FEB A
1002 100013 05-APR D
1002 100015 02-MAY A
1003 100014 03-MAR A
1003 100014 25-MAR D
1004 100016 22-MAY A
1004 100017 21-JUN A
1004 100018 01-JUL A
1005 100020 21-MAY D
1005 100020 21-JUL A
1005 100020 11-AUG D
Here the overall status of AgId '1000' is A as he is having atleast 1 Trm active
Similarly, status of AgId '1001' is A
status of AgId '1002' is A
But,status of AgId '1003' is D as his trm is disconnected after activation(according to date column'CD')
Then, status of AgId '1004' is A
and finally status of AgId '1005' is D again as his trm deactivated, activated and deactivated at last
So, considering these criteria can any one give me a query to get total no of AgId's who are 'Active' and similarly for 'Deactive'Hi,
when you put some code please enclose it between two lines starting with {noformat}{noformat}
i.e.:
{noformat}{noformat}
CREATE TABLE ... etc.
{noformat}{noformat}
Also do not forget to put correct statements. Your insert were missing semicolon at the end.
Coming back to your problem, I assum that the current status of any trm is the latest status so I have done what follows:
{code:sql}
SELECT agid
, trm
, cd
, s
, ROW_NUMBER () OVER (PARTITION BY agid, trm ORDER BY cd) rn
, COUNT (*) OVER (PARTITION BY agid, trm) rn_tot
FROM a
ORDER BY agid, trm, cd;
Output:
AGID TRM CD S RN RN_TOT
1000 100010 12-JAN-12 A 1 1
1000 100019 20-MAR-12 A 1 2
1000 100019 20-JUL-12 D 2 2
1001 100011 25-JAN-12 A 1 3
1001 100011 20-FEB-12 D 2 3
1001 100011 23-MAR-12 A 3 3
1001 100012 31-JAN-12 A 1 1
1002 100013 14-FEB-12 A 1 2
1002 100013 05-APR-12 D 2 2
1002 100015 02-MAY-12 A 1 1
1003 100014 03-MAR-12 A 1 2
1003 100014 25-MAR-12 D 2 2
1004 100016 22-MAY-12 A 1 1
1004 100017 21-JUN-12 A 1 1
1004 100018 01-JUL-12 A 1 1
1005 100020 21-MAY-12 D 1 3
1005 100020 21-JUL-12 A 2 3
1005 100020 11-AUG-12 D 3 3I have used to columns rn and rn_tot to find the latest entry for a specific agid, trm
Using the query above I have done the following:
WITH mydata AS
SELECT agid
, trm
, cd
, s
, ROW_NUMBER () OVER (PARTITION BY agid, trm ORDER BY cd) rn
, COUNT (*) OVER (PARTITION BY agid, trm) rn_tot
FROM a
SELECT agid
, CASE WHEN SUM (CASE s WHEN 'A' THEN 1 END) > 0 THEN 'A' ELSE 'D' END s
FROM mydata
WHERE rn = rn_tot
GROUP BY agid;
Output:
AGID S
1000 A
1001 A
1002 A
1003 D
1004 A
1005 D
{code}
Which is listing the agid and its status if at least there is one trm with final status 'A' for that agid.
To sum up everything you can do simply like this:
{code:sql}
WITH mydata AS
SELECT agid
, trm
, cd
, s
, ROW_NUMBER () OVER (PARTITION BY agid, trm ORDER BY cd) rn
, COUNT (*) OVER (PARTITION BY agid, trm) rn_tot
FROM a
totdata AS
SELECT agid
, CASE WHEN SUM (CASE s WHEN 'A' THEN 1 END) > 0 THEN 'A' ELSE 'D' END s
FROM mydata
WHERE rn = rn_tot
GROUP BY agid
SELECT S, COUNT(*) cnt
FROM totdata
GROUP BY S;
Output:
S CNT
D 2
A 4
{code}
Regards.
Al -
How to get total number of result count for particular key on cluster
Hi-
My application requirement is client side require only limited number of data for 'Search Key' form total records found in cluster. Also i need 'total number of result count' for that key present on the custer.
To get subset of record i'm using IndexAwarefilter and returning only limited set each individual node. though i get total number of records present on the individual node, it is not possible to return this count to client form IndexAwarefilter (filter return only Binary set).
Is there anyway i can get this number (total result size) on client side without returning whole chunk of data?
Thanks in advance.
Prashantuser11100190 wrote:
Hi,
Thanks for suggesting a soultion, it works well.
But apart from the count (cardinality), the client also expects the actual results. In this case, it seems that the filter will be executed twice (once for counting, then once again for generating actual resultset)
Actually, we need to perform the paging. In order to achieve paging in efficient manner we need that filter returns only the PAGESIZE records and it also returns the total 'count' that meets the criteria.
If you want to do paging, you can use the LimitFilter class.
If you want to have paging AND total number of results, then at the moment you have to use two passes if you want to use out-of-the-box features because LimitFilter does not return the total number of results (which by the way may change between two page retrieval).
What we currently do is, the filter puts the total count in a static variable and but returns only the first N records. The aggregator then clubs these info into a single list and returns to the client. (The List returned by aggregator contains a special entry representing the count).
This is not really a good idea because if you have more than one user doing this operation then you will have problems storing more than one values in a single static variable and you used a cache service with a thread-pool (thread-count set to larger than one).
We assume that the aggregator will execute immediately after the filter on the same node, this way aggregator will always read the count set by the filter.
You can't assume this if you have multiple client threads doing the same kind of filtering operation and you have a thread-pool configured for the cache service.
Please tell us if our approach will always work, and whether it will be efficient as compared to using Count class which requires executing filter twice.
No it won't if you used a thread-pool. Also, it might happen that Coherence will execute the filtering and the aggregation from the same client thread multiple times on the same node if some partitions were newly moved to the node which already executed the filtering+aggregation once. I don't know anything which would even prevent this being executed on a separate thread concurrently.
The following solution may be working, but I can't fully recommend it as it may leak memory depending on how exactly the filtering and aggregation is implemented (if it is possible that a filtering pass is done but the corresponding aggregation is not executed on the node because of some partitions moved away).
At sending the cache.aggregate(Filter, EntryAggregator) call you should specify a unique key for each such filtering operation to both the filter and the aggregator.
On the storage node you should have a static HashMap.
The filter should do the following two steps while being synchronized on the HashMap.
1. Ensure that a ConcurrentLinkedQueue object exists in a HashMap keyed by that unique key, and
2. Enqueue the total number count you want to pass to the aggregator into that queue.
The parallel aggregator should do the following two steps while being synchronized on the HashMap.
1. Dequeue a single element from the queue, and return it as a partial total count.
2. If the queue is now empty, then remove it from the HashMap.
The parallel aggregator should return the popped number as a partial total count as part of the partial result.
The client side of the parallel aware aggregator should sum the total counts in the partial result.
Since the enqueueing and dequeueing may be interleaved from multiple threads, it may be possible that the partial total count returned in a result does not correspond to the data in the partial result, so you should not base anything on that assumption.
Once again, that approach may leak memory based on how Coherence is internally implemented, so I can't recommend this approach but it may work.
Another thought is that since returning entire cached values from an aggregation is more expensive than filtering (you have to deserialize and reserialize objects), you may still be better off by running a separate count and filter pass from the client, since for that you may not need to deserialize entries at all, so the cost on the server may be lower.
Best regards,
Robert -
MDX How to get total distict count and SUM of subgroups?
with
MEMBER Measures.[EmailCount] as IIF(ISEMPTY([Measures].[Tran Count]), 0 ,[Measures].[Tran Count])
MEMBER Measures.AdvGroupTotal as
SUM (
FILTER( EXISTING ([Dim IFA Details].[Parent Key].[Adviser Group].Members * [Dim Date].[Fiscal].[Fiscal Year].members )
, Measures.[Amount] > 100 )
, Measures.[Amount])
MEMBER Measures.[AdvGrpCount] as
distinctCOUNT(Existing([Dim IFA Details].[Parent Key].[Adviser Group].Members * [Dim Date].[Fiscal].[Fiscal Year].members))
member Measures.IncomePerEmail as Measures.AdvGroupTotal /Measures.[EmailCount]
member Measures.AvgIncomePerFirm as Measures.AdvGroupTotal/ Measures.AdvGrpCount
SELECT { [Measures].[Amount] , Measures.[EmailCount], Measures.AdvGroupTotal, Measures.[AdvGrpCount],
Measures.IncomePerEmail, Measures.AvgIncomePerFirm }
ON COLUMNS,
[Dim Date].[Fiscal Year].[Fiscal Year].ALLMEMBERS * [Dim Date].[Fiscal Quarter].[Fiscal Quarter].ALLMEMBERS *
Except( [Dim Income Range].[Hierarchy].[Range ID].Members , [Dim Income Range].[Hierarchy].[All].UNKNOWNMEMBER.UNKNOWNMEMBER )
on rows
FROM [Income and Emails Cube]
where
[Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14]
The query above returns :
How can I get Totals for AdvGroupTotal and AdvGroupCount for the year ?
In the above case I want to tally up 1586 + 67 + 155 + 12 + 1718 for AdvGroupCount, same applies for the corresponding
AdvGroupTotal figures.
Seems simple enough, but I seem unable to come up with a way around this.
JonI worked it out with the help of Simon from another forum.
Using a filtered set will get me the result required. It is however not very quick, so I probably should look into building it into the cube.
WITH SET [Filtered Groups] AS
( Filter (
{ [Dim IFA Details].[Parent Key].[Adviser Group] } *
{ [Dim Date].[Fiscal Year].CurrentMember },
[Measures].[Amount] > 100
MEMBER [Measures].[Annual] AS
Sum ( [Filtered Groups], Measures.[Amount] )
MEMBER [Measures].[Firm Count] AS
DistinctCount ( [Filtered Groups] )
MEMBER [Measures].[Avg Income Per Firm] AS
[Measures].[Annual] / [Measures].[Firm Count]
MEMBER [Measures].[Test] AS
Sum (
{ [Dim Date].[Fiscal Quarter].[Fiscal Quarter] } * { [Dim Income Range].[Hierarchy].[Range ID] } * { [Filtered Groups] },
[Measures].[Amount]
MEMBER [Measures].[TotalCount] AS
DistinctCount (
{ [Dim Income Range].[Hierarchy].[Range ID] } * { [Filtered Groups] }
MEMBER [Measures].[TotalAvg] as [Measures].[Test]/ [Measures].[TotalCount]
MEMBER [Measures].[Quarter] as [Measures].[Amount]
SELECT
{ [Measures].[Quarter], [Measures].[Annual], [Measures].[Firm Count], [Measures].[Avg Income Per Firm],
[Measures].[Test], [Measures].[TotalCount], [Measures].[TotalAvg] } ON COLUMNS,
[Dim Date].[Fiscal Year].[Fiscal Year].AllMembers * [Dim Date].[Fiscal Quarter].[Fiscal Quarter].AllMembers *
Except ( [Dim Income Range].[Hierarchy].[Range ID].Members, [Dim Income Range].[Hierarchy].[All].UnknownMember.UnknownMember )
DIMENSION PROPERTIES Member_Unique_Name, MEMBER_CAPTION
ON ROWS
FROM [Income and Emails Cube]
WHERE [Dim Date].[Fiscal].[Fiscal Year].&[FY 13/14] -
Total count to be displayed in subtotal ALV(GRID Display)
Hello ,
I want to display total count in subtotal.
720 Mr JORGE 522,06
720 Mr JORGE 566,23
720 Mr JORGE 100,33
720 Mr JORGE 123,33
720 Mr JORGE 332,22
subtotal -> 720 1644.2 Count 5
888 Ms Mariam 100,00
subtotal -> 888 100,00 Count 1
Is this possible? Plz dont post same answers how to display subtotal. I am able to display subtotal , only issue is to display with count.
Edited by: Vimalnair on Aug 19, 2009 9:37 AMHi,
You cannot have subtotal for particular number of rows of ALV,
but if you want to get the total number of rows of the ALV data display
you can describe your final internal table from which the data is
getting displayed in ALV output and get it displayed in the header
or footer area of the ALV output.
For Eg:
DATA V_LINES TYPE I.
DESCRIBE TABLE IT_FINAL LINES V_LINES.
DATA: it_header TYPE slis_t_listheader,
wa_header TYPE slis_listheader.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = sy-repid
i_callback_pf_status_set = 'PF_STATUS'
i_callback_user_command = 'COMM'
i_callback_top_of_page = 'TOP' "This top will call the subroutine namely TOP
FORM top.
REFRESH it_header.
wa_header-typ = 'S'.
wa_header-key = text-001.
wa_header-info = sy-repid.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-key = text-002.
wa_header-info = sy-uname.
APPEND wa_header TO it_header.
CLEAR wa_header.
wa_header-typ = 'S'.
wa_header-key = text-003.
wa_header-info = V_LINES. "This will print the total number of lines in the header
APPEND wa_header TO it_header.
CLEAR wa_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = it_header
* I_LOGO =
* I_END_OF_LIST_GRID =
* I_ALV_FORM =
ENDFORM. "TOP
Hope it helps
Regards
Mansi -
GETTING ROW COUNTS OF ALL TABLES AT A TIME
Is there any column in any Data dictionary table which gives the row counts for particular table..
My scenario is...i need to get row counts of some 100 tables in our database...
instead of doing select count(*) for each table....is there any way i can do it?
similary How to get column counts for each table..in database .For example
Employee table has 3 columns...empid,empname,deptno....i want count(empid),
count(empname),count(deptno) ...is there any easy way for finding all column counts of each table in data base? is it possible?Why does "select count(mgr) from emp" return null and not 13?Good question ;)
Seems that xml generation in principle can't handle »counting nulls«:
SQL> select xmltype(cursor(select null c from dual)) x from dual
X
<?xml version="1.0"?>
<ROWSET>
<ROW>
</ROW>
</ROWSET>
1 row selected.
SQL> select cursor(select count(null) c from dual) x from dual
Cur
0
1 row selected.
SQL> select xmltype(cursor(select count(null) c from dual)) x from dual
select xmltype(cursor(select count(null) c from dual)) x from dual
Error at line 1
ORA-31011: XML parsing failed
ORA-19202: Error occurred in XML processing
LPX-00229: input source is empty
Error at line 0
ORA-06512: at "SYS.XMLTYPE", line 0
ORA-06512: at line 1
but
SQL> select xmltype(cursor(select count(1) c from dual)) x from dual
X
<?xml version="1.0"?>
<ROWSET>
<ROW>
<C>1</C>
</ROW>
</ROWSET>
1 row selected.Looks like a bug to me ... -
Mail error message in console log - "deleted count greater than total count
since installing Gmail IMAP instead of POP I get the following error message in the console log. Any ideas or solutions?
28/10/2009 14:19:04 Mail[1629] * Assertion failure in -[MessageViewer _countStringForType:isDrafts:omitUnread:totalCount:], /SourceCache/Mail/Mail-1076/MessageViewer.subproj/MessageViewer.m:5078
deleted count greater than total count
0 Message 0x00007fff84daf828 -[MFAssertionHandler _handleFailureWithPreamble:description:arguments:] + 137
1 Message 0x00007fff84daf78d -[MFAssertionHandler handleFailureInMethod:object:file:lineNumber:description:] + 220
2 Mail 0x00000001000356da 0x0 + 4295186138
3 Mail 0x00000001000316ba 0x0 + 4295169722
4 Foundation 0x00007fff8736f926 nsnotecallback + 167
5 CoreFoundation 0x00007fff8831fe4a __CFXNotificationPost + 954
6 CoreFoundation 0x00007fff8830c7f8 _CFXNotificationPostNotification + 200
7 Mail 0x000000010001dbe1 0x0 + 4295089121
8 Mail 0x000000010001dc52 0x0 + 4295089234
9 Foundation 0x00007fff8739b874 postQueueNotifications + 398
10 CoreFoundation 0x00007fff88337437 __CFRunLoopDoObservers + 519
11 CoreFoundation 0x00007fff8831305f CFRunLoopRunSpecific + 607
12 HIToolbox 0x00007fff82f0ec4e RunCurrentEventLoopInMode + 333
13 HIToolbox 0x00007fff82f0ea53 ReceiveNextEventCommon + 310
14 HIToolbox 0x00007fff82f0e90c BlockUntilNextEventMatchingListInMode + 59
15 AppKit 0x00007fff815bd520 _DPSNextEvent + 718
16 AppKit 0x00007fff815bce89 -[NSApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 155
17 AppKit 0x00007fff81582a7d -[NSApplication run] + 395
18 AppKit 0x00007fff8157b798 NSApplicationMain + 364
19 Mail 0x000000010000167c 0x0 + 4294973052
20 ??? 0x0000000000000002 0x0 + 2
)Welcome to the forums Oliver... good work at narrowing the problem down so far!
Try dragging this file to the Desktop and reboot...
/Users/nnnn/Library/Preferences/com.apple.mail.plist
Might also pay to clean caches, I use Applejack, but there are many. The log makes me think cache especially. -
Hi,
I want to get the total count of open invoices and paid invoices and total amount for a give list of vendors between a date range. Could anyone tell me what tables I should use to get the data?
ThanksHi,
two vendor tables BSIK (for open items) and BSAK (for vendor cleared items) will serve the purpose for using them in you program.
regards,
chaitanya -
How to find total count of records in a cursor
Aassume below is the cursor i defined
cursor c1 is select * from emp;
now, i want to find the total count of records in this cursor using an existing function etc., using one line statement.
FYI: c1%rowcount is always giving 0, so i cant rely on this.
Any thoughts, please share.
Thanks in advance.I am just showing this to show how to get the rowcount along with the cursor, if the program has so much gap of between verifying the count(*) and opening the cursor.
Justin actually covered this, he said, oracle has to spend some resources to build this functionality. As it is not most often required, it does not makes much sence to see it as a built-in feature. However, if we must see the rowcount when we open the cursor, here is a way, but it is little bit expensive.
SQL> create table emp_crap as select * from emp where 1 = 2;
Table created.
SQL> declare
2 v_cnt number := 0;
3 zero_rows exception;
4 begin
5 for rec in (select * from (select rownum rn, e.ename from emp_crap e) order by 1 desc)
6 loop
7 if v_cnt = 0 then
8 v_cnt := rec.rn;
9 end if;
10 end loop;
11 if v_cnt = 0 then
12 raise zero_rows;
13 end if;
14 exception
15 when zero_rows then
16 dbms_output.put_line('No rows');
17 end;
18 /
No rows
PL/SQL procedure successfully completed.
-- Now, let us use the table, which has the data
SQL> declare
2 v_cnt number := 0;
3 zero_rows exception;
4 begin
5 for rec in (select * from
6 (select rownum rn, e.ename from emp e)
7 order by 1 desc)
8 loop
9 if v_cnt = 0 then
10 v_cnt := rec.rn;
11 dbms_output.put_line(v_cnt);
12 end if;
13 end loop;
14 if v_cnt = 0 then
15 raise zero_rows;
16 end if;
17 exception
18 when zero_rows then
19 dbms_output.put_line('No rows');
20 end;
21 /
14
PL/SQL procedure successfully completed.Thx,
Sri -
To get the count of records and able to access the column value in a single
Hi
Is there any way to get the number of records in the query and access the column values
e.g
select count(*)
from
(SELECT department, COUNT(*) as "Number of employees"
FROM employees
WHERE salary > 25000
GROUP BY department ) a
This wil only get the Count, if i want to access each row from the inline view how can i do that.Your question is not clear.
Are you looking for total record count as well as count by department ?
Something like this?
SQL>
SQL> with temp as
2 (
3 select 1 dept ,10000 sal from dual union
4 select 1 dept ,25100 sal from dual union
5 select 1 dept ,30000 sal from dual union
6 select 1 dept ,40000 sal from dual union
7 select 2 dept ,10000 sal from dual union
8 select 2 dept ,25100 sal from dual union
9 select 2 dept ,30000 sal from dual union
10 select 2 dept ,40000 sal from dual )
11 select count(*) over( partition by 1 ) total_count,dept,
12 count(*) over(partition by dept) dept_cnt from temp
13 where sal>25000;
TOTAL_COUNT DEPT DEPT_CNT
6 1 3
6 1 3
6 1 3
6 2 3
6 2 3
6 2 3
6 rows selected
SQL> -
How to get attendies count for a calendar list in sharepoint 2013?
Hi everybody,
I am using calendar list in SharePoint 2013 for my project.
Could please tell me how to get the count of attendees using SP Designer or OOTB calculated field.
Because I want to display the fields like
TOTAL SEATS =20
Attendees= Need count
Avail seats= total - Attendees count.
In that way I want to show information about availability seats for training session.
Regards,
DhayanandHi Dhaya
Please refer the links.Hope it helps :-)
http://social.msdn.microsoft.com/Forums/en-US/b8677dc5-3eb1-4bdc-92f2-f57201bfabb1/field-that-counts-attendees?forum=sharepointcustomizationprevious
http://sharepoint.stackexchange.com/questions/54253/use-count-related-column-value-as-int-in-a-sp-designer-workflow -
I'm trying to get the count for each row to total count for each month
Something like this
Hardware | Jan
Monitors | 5
Processors | 137
Printers | 57
etc........
How can I write a query for this. I can get the Hardware column but don't know how to get the next column.If you can provide more data like sample input DML statements it would have been wonderful..
Assuming is , you need a pivot. Here is an article on basic Pivot..
http://sqlsaga.com/sql-server/how-to-use-pivot-to-transform-rows-into-columns-in-sql-server/
something like this may be..
DECLARE @Input TABLE
Hardware VARCHAR(20),
[Date] VARCHAR(20)
INSERT INTO @Input VALUES('Monitor', '01/01/2014'), ('CPU', '01/01/2014'), ('Monitor', '01/03/2014')
, ('ABC', '01/01/2014'),('Monitor', '02/01/2014')
;WITH CTE AS
SELECT Hardware, LEFT(DATENAME(M, [Date]),3) AS [MonthName] FROM @Input
SELECT *
FROM
SELECT Hardware, [MonthName], COUNT(Hardware) AS Count FROM CTE GROUP BY Hardware, [MonthName]) a
PIVOT (MAX([Count]) FOR [MonthName] IN ([Jan], [Feb])) pvt
Please mark as answer, if this has helped you solve the issue.
Good Luck :) .. visit www.sqlsaga.com for more t-sql code snippets and BI related how to articles. -
Get the count of rows in a table control
Hi Experts,
How do I get the count of the rows in a table control during run time.
I am developing a BDC in which I have to check all entries in a table control.
My requirement is to get the total number of rows in a table control dynamically.
Thanks
KumarHi,
Use a variable when u r passing the records from the internal table to the screen fields
and display the same.
I think this idea may help u.
And pls explain me ur requirement clearly.
Refer to the following link this may help u.
http://sapabapnotes.blogspot.com/2008/03/working-with-ecatt-extended-computer.html
Reward if helpful.
Jagadish -
How to get the count of PO'S raised by a user
Hi,
I have a new requirement whr i am asked to get the count of number of PO'S raised by a particular user in report. Suppose the user raised 10 purchase orders .
The requirement is when a user name is given it has to give count of 10.
Where shud i include this,in rows or columns. Please suggest.
Thanks&Regards,
PraveenHi Praveen,
take a look in www.service.sap.com/bi, under old release, for release 2.x you will find an How to that detail how to count occurencies of a Char. Maybe you will find here the solution.
Ciao.
Riccardo.
Maybe you are looking for
-
How can I remove LABELS from my gmail account?
How can I remove unwanted LABELS from the side bar unsung gmail?
-
How long until Oracle posts BPM Suite bundle definition and costs???
Alright... how long do we have to wait until Oracle officially posts what is in the BPM Suite and updates the price list? The current web site contents certainly don't have the up to date BPM Suite product bundle correctly identified. The May price l
-
Problems with the output of an array
Hallo, I have got problems with giving out an array. I declared two arrays and puted them out, but with the resultarray it doesn�t work. Cansomebody help me? Here is a runtime output: Grad eingeben! 1 Koeffizienten eingeben! 1 2 1x^0 + 2x^1 + 1 Grad
-
Hi BPM Gurus, Need your expert advice on how to address below scenario There is parallel WF between actors Buyer and Supplier. If only both actors approve then only it need to go to next level else if either of actors i.e Buyer or Supplier rejects ,
-
Wow, wine, error loging in...
Hi, I've recently installed WoW on my linuxbox (archlinux) i'm able to update but not able to connect in WoW, it's like it's not even trying to search for my Login/passwd. It just gives me an error: There was an error loging in. Please try again late