Count the numbers of results
How do you count the number of returned rows in CF? Note not
the number
of the row, but the the order by number of each row returned.
Thanks in advance.
I dont think I quite understand your question, but...
#queryname.RecordCount# gives the total number of rows
returned.
#queryname.CurrentRow# gives the row number you are working
on.
Similar Messages
-
Count the numbers in a column??
Hi Guys!!
I have a column in a table:
Number
100
2
1
19
2
11
27
14
28
12
9
12
54
72
1
17
I want to calculate how many of those are:
Less than 50,
50 to 99,
100 to 149,
149 to 199 and like that.......Plz suggest me the Query.
Cheers,
APSuppose you have a table T with column N.
SQL> select * from t;
N
5
10
15
50
60
70
75
80
85
95
SQL> select trunc((n-1)/50)+1,count(*)
2 from t
3 group by trunc((n-1)/50)+1
4 /
TRUNC((N-1)/50)+1 COUNT(*)
1 4
2 6
where 1 is for values from 0-50, 2 for 51-100 and so on.
Anwar -
Table monitoring , how do oracle count the numbers ?
hi,
i'm looking at all_tab_modifications , just couldn't figure out where those numbers from ,
DB.9208 , table partitioned
looks like it off of what it should be
my question is
1. when does montioring take place , and by how?
2. is the number cumulative from monitoring turn on ? from instance restart ? or between two snaps ?
3. offical doc says like inserts is Approximate number of inserts since the last time statistics were gathered
that means the number recycles after snap taken , it goes on by every DML , but i have insertions against a table which says inserts is 0
4. some says to reflect the newest exec dbms_stats.flush_database_monitoring_info; which is even more confusing for me and makes no difference in my case
thanks
TABLE_NAME INSERTS UPDATES DELETES TIME
T_GB_RA_PAGING 0 0 2372389 20081125 005005
T_IU_OVERLOAD 0 0 0 20081125 005005
T_RAUM 0 0 13963245 20081125 005005
T_GB_SGSN_DATA 0 0 33283 20081125 005005
T_IU_SGSN_DATA 0 0 0 20081125 005005
T_SESSION_MANAGEMENT 82 0 386950042 20081125 005005
T_DATA 82 0 1595707 20081125 005005
T_USER 82 0 112562 20081125 005005
T_MOBILITY_MANAGEMENT 82 0 515890902 20081125 005005
T_DIPN 82 0 0 20081125 005005
T_RAUM 22409 0 0 20081125 103237
T_SESSION_MANAGEMENT 365547 0 0 20081125 103237Edited by: zs_hzh on Nov 24, 2008 10:35 PM1. when does montioring take place , and by how?When you create a table, by default, it is set in MONITORING mode.
SQL> create table testtable as select * from all_objects where 1 = 2;
Table created.
SQL> select monitoring from user_tables where table_name='TESTTABLE';
MON
YES
2. is the number cumulative from monitoring turn on ? from instance restart ? or between two snaps ?http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2097.htm#i1591024
<quote>
ALL_TAB_MODIFICATIONS describes tables accessible to the current user that have been modified since the last time statistics were gathered on the tables.
<quote>
3. it goes on by every DML , but i have insertions against a table which says inserts is 0Is your table in MONITORING mode? If not, there will be no records in this view for that table.
4. some says to reflect the newest exec dbms_stats.flush_database_monitoring_info; which is even more confusing for me and makes no difference in my caseIt could be related to answer for #3.
Refer to this small demonstration.
SQL> execute dbms_stats.gather_table_stats(user,'TESTTABLE');
PL/SQL procedure successfully completed.
SQL> select * from all_tab_modifications where table_owner=USER and table_name='TESTTABLE';
no rows selected
SQL> insert into testtable select * from all_objects;
55958 rows created.
SQL> commit;
Commit complete.
SQL> select * from all_tab_modifications where table_owner=USER and table_name='TESTTABLE';
no rows selected
SQL> execute dbms_stats.flush_database_monitoring_info;
PL/SQL procedure successfully completed.
SQL> select table_name, inserts from all_tab_modifications where table_owner=USER and table_name='TESTTABLE';
TABLE_NAME INSERTS
TESTTABLE 55,958
SQL> insert into testtable select * from all_objects;
55958 rows created.
SQL> select table_name, inserts from all_tab_modifications where table_owner=USER and table_name='TESTTABLE';
TABLE_NAME INSERTS
TESTTABLE 55,958
SQL> execute dbms_stats.flush_database_monitoring_info;
PL/SQL procedure successfully completed.
SQL> select table_name, inserts from all_tab_modifications where table_owner=USER and table_name='TESTTABLE';
TABLE_NAME INSERTS
TESTTABLE 111,916 -
How to count the pulses of an incrementa​l encoder with PCI-6010?
Hi everyone,
I am trying to use an incremental encoder and PCI-6010 card to measure the speed of a rotary shaft in Labview 2011. I need to use the counter to count the numbers of the pulses that the encoder generates but I have some problems there to do so.
I connected the encoder signal to the counter source (PFI0) and built a daq assistant block in the Labview (Acquire signals -> Counter Input -> Edge Count -> ctr0) and it is set as shown in the figure. The problem is that no matter how I turn the shaft the measured value will always be 0 although the pulses can be seen very clearly on the O-scope.
I suppose I must have made a very simple mistake. Could anyone help me on that please?
Thank you.Hi YShZh,
The current Acquisition Mode setting is set to "1 Sample (On Demand)" and will therefore only ever give you the first count value. The fist count value is equal to the initial count value, which in your case is 0.
Try changing the acquisition mode to either N Samples or Continuous Samples.
Kind regards,
Marshall B
Applications Engineer
National Instruments UK & Ireland -
ITunes 11 couldn't count the number of your music at bottom? Help
why now iTunes couldn't count the numbers or the whole time to play the music at the below part of iTunes just like old version used to do?
Go to View > Show Status Bar
-
How can I do Count the Words in a cell with Numbers?
I'm producing a documentary, with a long list of captions. I was hoping using numbers to organize the captions in sequence. them take the word count and do a simple calculation to work out the numbers of frames required per caption, based on a certian numbers of words per minute.
I can handle calculations, but can't figure out how/if numbers can count the whole words in a cell and pass that on to a formula.
I count them manually, but the nature of the script means the captions are being constantly updated.
Any help appreciated!Clever. The only additional suggestion is to use the function Trim() just in case there are extra spaces between the words.
=LEN(TRIM(B))-LEN(SUBSTITUTE(B," ",""))+1
Rob -
Count the number of rows resulting from a select statement
Hi,
Is there any way of counting the number of rows resulting from a select statement. i.e I have a select distinct statement and I then want to perform an IF statement on the number of rows resulting from the select statement.
Any help appreciated
Thanks
GaryDeclare
var1 number;
Begin
select count(distinct column_name) into
var1 from table_name;
If var1 > x Then
End IF;
End;
Hope I understood the problem correctly
null -
[Question]how to count the occurance of numbers inside the array
im just practicing my java skill but i cant get my program work can you give me guys some idea on how to determine a number that occured more than 1 inside the array e.g i have 10 elements and inside of my offset i have
1,2,5,4,5,6,5,8,9,5
and what im planning to do is count the occurances of the number who occures more than 1 and for that 5 occur 3 times how my program can know that i use for loop but cant figure out how to filter the occurances of numbers inside
my offset
thank'sEncephalopathic you said put - 1 instead i did - 2
public class sample
public static void main(String args[])
int num[] = {2,2,2};
int index1, count = 0, find = 0;
for(index1 = 0; index1 < num.length - 2; index1++)
for(int index2 = 0; index2 < num.length; index2++)
if(num[index2]==num[index1])
find = num[index2];
count++;
System.out.println("i found " + find + " " + count + " same number inside your offset");
}output is:
i found 2 3 same number inside your offset
but another question is what if i want my program to tell the other number that occur 1 time
like this:
i found 1 2 same number inside your offset
i found 2 0 same number inside your offset
i found 1 2 same number inside your offset -
How do I count the unique value pairs in two columns of a table?
I have a table (Table 2) that is populated with data from an imported .csv file. On table 1 I need to count the unique value pairs in two columns of Table 2.
Here's what I have:
Date Person
7/10/2011 A
7/12/2011 W
7/12/2011 X
7/12/2011 X
7/12/2011 X
7/12/2011 Z
7/14/2011 Z
7/15/2011 X
7/16/2011 Z
I'm focusing on person "X" and can easily count how many days that person shows up but what I want is to see on how many unique days that person shows up.
Here's the result I'm looking for (Person "X" shows up on 2 different days - 3 times on 7/12/2011 and once on 7/15/2011):
X 2
I can't seem to find a function that allows me to do that. I also am not allowed to modify Table 2 so that leaves me to come up with a solution on Table 1.
Any ideas would be greatly appreciated.Hi John,
Not being allowed to modify Table 2 is a minor inconvenience. Just copy (using a formula) the necessary two columns onto Table 1.
Yellow columns may be hidden. The procedure progresses from left to right. All formulas are entered into row 2 then filled down that column to the end of the table. The table must be as long as the list in column A of Table 2.
A2: =Table 2::A
Fill right to column B.
Fill both columns down as far as needed.
I've used actual Date and Time values in column A, formatted to show only the Date part, but the technique will work with text in these cells, provided all cells representing the same 'date' have exactly the same content.
C2: =A&B
This concatenates the contents of each row of columns A and B into a single text string.
D2: =COUNTIF($C$2:C2,C)
This counts the number of occurrences of the Date&Name string on the current row from the first regular cell in column C (C2) to the current cell.
E2: =IF(COUNTIF($B$2:B2,B)=1,MAX($E$1:E1)+1,"")
This constructs the index of first occurrences of each name, in the order they first occur. The index is used by LOOKUP in column F.
F2: =IF(ROW()-1>MAX(E),"",LOOKUP(ROW()-1,$E,$B))
This uses the index value created in E as a search-for value to extract a single copy of the names in column B. The result is a list of all distinct names in the list. Note that spelling differences will be counted as distinct names.The IF statement stops the listing when the last distinct name is extracted.
G2: =IF(LEN(F)>0,COUNTIFS($B,"="&F,$D,"=1"),"")
This counts the number of 'first occurrences of distinct Date & Name strings for each name on the list (ie. the number of distinct dates on which each name appears in the original list).
All of the functions used are described, with at least one example for each, in the iWork formulas and Functions User Guide. You can download the guide, and the Numbers '09 User Guide, via the Help menu in numbers.
Regards,
Barry -
How can I count the number of unique cells?
I have a column in my spreadsheet that looks like this:
Date
Items
3/25
Item A
3/27
Item A
3/29
Item A
3/25
Item A
4/25
Item B
6/1
Item B
7/13
Item B
8/9
Item B
3/5
Item C
1/2
Item C
5/15
Item D
3/25
Item D
What I want is something that will list all the unique items that I have and count the number of times that Item shows up in my spreadsheet. For example, the results should look like this:
Item A: 3
Item B: 4
Item C: 2
Item D: 2
I thought for sure that I can do a chart in numbers and it would count the number of items but no, not so much.I apologize. When I pasted the table in Numbers running in French the values of column B were treated as dates.
I leave the screenshot untouched because the contents of this column changes nothing to the calculations.
In cell D2 of the main table, the formula is :
=IF(ISBLANK(C),0,IF(COUNTIF($C$2:$C2,"="&$C2)=1,COUNTIF(C,"="&$C2)+(ROWS(A)-ROW( ))/100000,0))
Apply Fill Down
In cell A2 of table aux, the formula is :
=IFERROR(LARGE(main :: D,ROW()-1),"")
In cell B2 of table aux, the formula is :
=IF(A>0,LOOKUP(A2,main :: D,main :: C),"")
In cell C2 of table aux, the formula is :
=INT(A)
Apply Fill Down
Yvan KOENIG (VALLAURIS, France) samedi 6 août 2011 23:33:10
iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.0
My iDisk is : <http://public.me.com/koenigyvan>
Please : Search for questions similar to your own before submitting them to the community
To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer ! -
How can i set the number of results that can be displayed on the page
hello im just wondering how i can set the numebr of results that can be dispaleyd on the jsp, when the there are more than 5 results i want the suer to press more
how is this odne could anyone send me a example code?
and also how can i get results from the query displayed as select list options, so that when they press one of teh results it goes to correspnding page
Thank youHi,
I assume that you have the connection to the DB.
You can try this code.
Statement stmt = con.createStatement();
String sql = "<some sql code for selecting>";
ResultSet rs = stmt.executeQuery(sql);
rs.last();
int count = rs.getRow(); // this is the number that shows how many numbers you have after select query
rs.first(); //we moved cursor again to the begining of the results.
if (count > 5) {
for (int i=0;i<5;i++) {
//as an example
rs.getString(0);
rs.getString(1);
rs.getString(2);
out.print("<a href='morePage.jsp'>More</a>");
else {
for (int i=0;i<count;i++){
//as an example
rs.getString(0);
rs.getString(1);
rs.getString(2);
rs.close();
stmt.close();I hope this would help you.
If you have problems let me know..
Ismail TURK -
Counting consecutive numbers into one row
Hello everyone,
I have recently discovered that we can use Max ( Decode ()) function of Oracle to pivot the results of a table. I have executed this just fine. However, pivoting a table is just one part of the solution that I need. The pivoting function results to something like this:
01,02,03,05,06,07,08,09,10,11,12,13,14,16,17,20,21,23,25What I actually need is something like this:
1-17, 20-21,23,25I really don't know how to start solving this but so far I have the below query:
SELECT DISTINCT
MAX(DECODE(wldw.wafernumber,'01', '01'))
|| MAX(DECODE(wldw.wafernumber,'02', ',02'))
|| MAX(DECODE(wldw.wafernumber,'03', ',03'))
|| MAX(DECODE(wldw.wafernumber,'04', ',04'))
|| MAX(DECODE(wldw.wafernumber,'05', ',05'))
|| MAX(DECODE(wldw.wafernumber,'06', ',06'))
|| MAX(DECODE(wldw.wafernumber,'07', ',07'))
|| MAX(DECODE(wldw.wafernumber,'08', ',08'))
|| MAX(DECODE(wldw.wafernumber,'09', ',09'))
|| MAX(DECODE(wldw.wafernumber,'10', ',10'))
|| MAX(DECODE(wldw.wafernumber,'11', ',11'))
|| MAX(DECODE(wldw.wafernumber,'12', ',12'))
|| MAX(DECODE(wldw.wafernumber,'13', ',13'))
|| MAX(DECODE(wldw.wafernumber,'14', ',14'))
|| MAX(DECODE(wldw.wafernumber,'15', ',15'))
|| MAX(DECODE(wldw.wafernumber,'16', ',16'))
|| MAX(DECODE(wldw.wafernumber,'17', ',17'))
|| MAX(DECODE(wldw.wafernumber,'18', ',18'))
|| MAX(DECODE(wldw.wafernumber,'19', ',19'))
|| MAX(DECODE(wldw.wafernumber,'20', ',20'))
|| MAX(DECODE(wldw.wafernumber,'21', ',21'))
|| MAX(DECODE(wldw.wafernumber,'22', ',22'))
|| MAX(DECODE(wldw.wafernumber,'23', ',23'))
|| MAX(DECODE(wldw.wafernumber,'24', ',24'))
|| MAX(DECODE(wldw.wafernumber,'25', ',25')) AS WAFERS
FROM a_wiplothistory wl
JOIN Container C ON (wl.containerid = c.containerid OR wl.containerid= c.splitfromid )
JOIN a_wiplotdetailshistory wld ON wl.wiplothistoryid = wld.wiplothistoryid
JOIN a_wiplotdetailswafershistory wldw ON wld.wiplotdetailshistoryid = wldw.wiplotdetailshistoryid
WHERE c.containername = :lotThanks for helping guys.
Edited by: 1001275 on May 15, 2013 6:28 PMHi,
1001275 wrote:
Hello everyone,
I have recently discovered that we can use Max ( Decode ()) function of Oracle to pivot the results of a table. I have executed this just fine. However, pivoting a table is just one part of the solution that I need...You said it!
First, you need some way of grouping consecutive rows together (1-17 in one group, 20-21 in anoter, 23 as a group all by itself, and so on).
Then you need GROUP BY to get infmation about each goup, such as the smallest and largest number in the group.
Finally, you need to combine all that information into one big string. This is actually an example of String Aggregation , rather than pivoting. The two are closely related. Pivot means you're taking 1 column on multiple rows, and putting them into multiple columns on one row. String Aggregation is taking 1 column on multple row, and concatenating all their contents into one big string column.
Here's one way to do it:
WITH got_group_id AS
SELECT wafernumber
, ROW_NUMBER () OVER (ORDER BY wafernumber)
- wafernumber AS group_id
FROM wldw
, got_group_info AS
SELECT TO_CHAR (MIN (wafernumber))
|| CASE
WHEN COUNT (*) > 1
THEN '-' || TO_CHAR (MAX (wafernumber))
END AS group_label
, ROW_NUMBER () OVER (ORDER BY MIN (wafernumber))
AS group_num
FROM got_group_id
GROUP BY group_id
SELECT SUBSTR ( SYS_CONNECT_BY_PATH (group_label, ',')
, 2
) AS txt
FROM got_group_info
WHERE CONNECT_BY_ISLEAF = 1
START WITH group_num = 1
CONNECT BY group_num = PRIOR group_num + 1
AND prior sys_guid () is not null
;I find the first part of this query to be the trickiest. I used the Fixd Difference technique to assign a common group_id to consecutive rows. See {message:id=9953384} and/or {message:id=9957164} foran explantaion of the Fixed Difference technique.
Next, in sub-query got_group_info, I used aggregate functions to produce a group_label, such as '1-17', and to assign consecutive numbers to each group. This is also a little tricy, because it involves nesting an aggregate function (MIN in this case) inside an analytc function (ROW_NUMBER).
Finally, I used SYS_CONNECT_BY_PATH to do the string aggregation.
Output:
TXT
1-17,20-21,23,25Whenever you have a question, please post CREATE TABLE and INSERT statements for some sample data. For example:
CREATE TABLE wldw
( wafernumber NUMBER (3) PRIMARY KEY
INSERT INTO wldw (wafernumber) VALUES ( 1);
INSERT INTO wldw (wafernumber) VALUES ( 2);
INSERT INTO wldw (wafernumber) VALUES ( 3);
INSERT INTO wldw (wafernumber) VALUES ( 4);
INSERT INTO wldw (wafernumber) VALUES ( 5);
INSERT INTO wldw (wafernumber) VALUES ( 6);
INSERT INTO wldw (wafernumber) VALUES ( 7);
INSERT INTO wldw (wafernumber) VALUES ( 8);
INSERT INTO wldw (wafernumber) VALUES ( 9);
INSERT INTO wldw (wafernumber) VALUES (10);
INSERT INTO wldw (wafernumber) VALUES (11);
INSERT INTO wldw (wafernumber) VALUES (12);
INSERT INTO wldw (wafernumber) VALUES (13);
INSERT INTO wldw (wafernumber) VALUES (14);
INSERT INTO wldw (wafernumber) VALUES (15);
INSERT INTO wldw (wafernumber) VALUES (16);
INSERT INTO wldw (wafernumber) VALUES (17);
INSERT INTO wldw (wafernumber) VALUES (20);
INSERT INTO wldw (wafernumber) VALUES (21);
INSERT INTO wldw (wafernumber) VALUES (23);
INSERT INTO wldw (wafernumber) VALUES (25);I realize that your table (and your query) are a lot more complicated, but it looks like you can show the part you don't already understand using just this one table with this one column.
Also, whenever you have a question, say which version oif Oracle you'e using (e.g., 11.2.0.2.0).
The query above should work in Oracle 10.1 and up. I got the wong results in the main query in Oracle 10.2, however. (Oracle 10.2 has a lot of bugs related to CONNECT BY.) It worked fine in version 11.1.
If you're using Oracle 11.2, you'll want to use LISTAGG, not SYS_CONNECT_BY_PATH, to do the string aggregation.
For more about string aggregation in various versions of Oracle, see this Oracle Base page. -
Count the number of unique values in column
Hi
I have a large numbers file (thousands of rows) with data for different dates. I need to calculate the number of unique (distinct) dates are in the spreadsheet.
Does anyone know how to do this?
Thanks,
Brucebpj,
Let's say your date is in column B for this example and your first data row is Row 2. In another column you can enter into row 2: =IF(COUNTIF($B$2:B2, B)=1, 1, "") Summing the new column content will yield the number if unique dates.
As badunit observes, this will result in sluggish document. If the number of possible dates is small compared to the number of rows of data, it would be better to make a table of possible dates and count the number of occurrences of each of those dates in the data, a COUNTIF function on the frequency data for the date range will give you the number of unique dates, possible much more efficiently.
Jerry -
Can not change the number of decimal places in the normalization of result
dear all
i want to see the proportion of some data, for example, the income of May is 300, and the total income is 1000, i need to display it like 33.33% . so i set the
Calculate single values as normalization of result, and then it display 33.333%, i like to display only two number of decimal places, so i set the number of decimal places as 0.00, but i doesn't work, it still display three decimal numbers.
maybe you say i can use the percentage function like %CT %GT %RT, but i need to allow external access to my query, so the i can not use those functions.
can somebody helps me ? your advice is appreciated.hi,thanks for your advice, but that doesn't suit for my problem.
before i set the normalization of result, i can change the decimal values. After that i cann't.
In your thread, someone proposes use the T-code OY04. but this wouldn't help. As i change to other key figure, such as user quantity, when i set normalization of result, it still display 3 decimal values.
i think the point maybe lie in the normalization of result. please advise... thanks... -
I'm using Numbers 3.2 and would like to count the names in a column which satisfy a condition in a different column. There are 3 "streams" through which these names have come to me, and I would like to easily identify how many have come from each stream. Any help?
Hi DirtyDawg,
COUNTIF is your friend here.
If your source is in column C and your streams are 1, 2 and 3:
=COUNTIF(C,"=stream1")
=COUNTIF(C,"=stream2")
=COUNTIF(C,"=stream3")
These need to be in a footer or header row or in a different column than C.
hope this helps,
quinn
Maybe you are looking for
-
HI, i recently just switched to verizon and so far i have loved it. But now im running into an issue and itseems almost impossible to get ahold of anyone via phone for support so im going to try this way. I am mid way through my month and i have ran
-
How to do a clean install without loosing anything
Hi all, I (foolishly) installed Mac OS X 10.6 Snow Leopard as an update to my existing 10.5.8 Leopard install last year. Ever since I've had a host of small but annoying problems, that no one else seems to be complaining about. (For example in the fi
-
i have a the code below which i am passing a form value to <CFLOCATION url="CalendarCurrent.cfm?DATE=<cfoutput>#form.Diary_Date#</cfoutput>"> but i am getting cannot convert to a date error, i cannot change the code below as other pages use it, so ho
-
BB Curve - homescreen data/calendar view - nothing shows up!
Hello - I have the BB Curve. I have my front screen set so that I can see the calendar and my appointments. I have been putting my appointments in, but they are not showing on the front page! I know I Have multiple calendars because I have multipl
-
Yet another MPC 1000 L7 Sync post
i searched through the forum archives and didnt find the sync problem im having with my particular setup. im trying to slave the mpc from logic and have the mpc output signal its coaxial spdif. im using a m-audio 410, logic 7 (duh), and the MPC 1k. i