Unique row count in table footer
JDev 11.1.1.6
Hi,
In my current table, I am able to show total row count at a table footer by using #{bindings.<myVO>Iterator.estimatedRowCount}.
I have a request from my user to show unique total row count. For example rows below:
1 A
2 B
3 A
4 C
The footer should show:
4 3
The second column has A, B, and C where A is counted only 1 (unique). Is there a way to achieve this?
Thanks.
Hi RRA,
This may work for a static # of rows (no filtering). In the table I use, I can do filtering and that certainly will make the count result be different if I use another VO for distinct result.
Thanks.
Similar Messages
-
Query for how to display unique rows in a table
Can i have a query for displaying unique rows in a table.
use d query
select distinct col1,col2... from table ; -
Select unique rows from two tables...
Hi,
I have two tables, replies1 and replies2.
SQL> desc replies
Name Null? Type
URN VARCHAR2(36)
ADDRESS VARCHAR2(18)
FILESIZE NUMBER
AS_NUM VARCHAR2(6)
SQL> desc replies2
Name Null? Type
URN VARCHAR2(36)
ADDRESS VARCHAR2(18)
AS_NUM VARCHAR2(6)
Both of the tables have no primary keys, but I have indixes on (urn, addrss) combination on both....
I am trying to select the unique rows with (urn, address) from replies2, and then find the matching size from replies...
I am using the following query:
select distinct replies2.urn, replies2.address, replies.filesize from replies2, replies where replies2.AS_NUM like 'XYZ' and replies.urn = replies2.urn;
I cannot figure out why it won't work. the way I understand it is that, distinct will give all distinct combination of all column names that follow, which is what I want...
I know it is wrong, because the query:
select count(*) from replies2 where AS_NUM like 'XYZ' returns less number of rows than the above query.
Any help would be greatly appreciated.
Thank you
Oz.Thanks a lot Mohan for your reply.
urn is not a unique key. Several rows could have the same (urn, address) pair in both tables. What I want is retrieve all (urn, address) rows from one table, and find the size from the other table to make a (urn, address, size). I want all unique combinations of (urn, address) to appear in the output.
AS_NUM is an empty column in replies... It would've been a lot easier if it wasn't, since then I'll just say: select distinct urn, address, filesize from replies where AS_NUM like 'XYZ';
I will try your query though and let u know how it goes. It takes quite a while to run since my tables are huge. -
Interactive report unique row count
Hi,
I just want to know if there is a way to do a row count with a unique on an interactive report column.
What I mean is that I have a report that looks like that
Project Project type Hours
Project 1 Project type 1 1
Project 2 Project type 2 1
Project 1 Project type 1 1
Project 3 Project type 3 1
Project 2 Project type 2 1
I would like to do a unique on the project name. So, at the end, I would like to have a count that says that I have 3 different projects.
Is there anyway to do that ?
Thanks,
ChantaleHi Chantale - did you manage to solve this one?
Example here (http://apex.oracle.com/pls/otn/f?p=11189:1) showing 14 rows, but only 7 distinct rows. These duplicates are valid, and the SQL cannot be changed. Is there a way through the IR to show a count of 7 (the distinct rows)?
Thanks,
Mike
Edited by: Mike, UK on Oct 2, 2009 12:04 PM -
Row count for tables from 2 different databases
Hi,
i wrote a query to get counts from all the tables in one schema to another schema. this generates the select count (*) from tables and gives me the counts, but i want to get the counts such as
table1 -- 100 -- DB1
table1 - 110
table2 - 230 - DB2
table2 - 230 etc...
here is my query that works but display of the output is the way i wanted. can someone help me getting the output as above described.
select 'select ''PTO'', count(*) as '||(table_name)||'_count'||' from '||table_name||';'from dba_tables
where owner = 'TEST'
union all
select 'select ''PFO'', count(*) as '||(table_name)||'_count'||' from '||table_name||';'from [email protected]
where owner = 'TEST';
thanks...DUPLICATE post
count of rows in a schema tables -
Display of selected row no in table footer.
Hi,
Row no of first row is generally displayed in the footer of the table as
Row <first row rowno> of <total no of rows>.Eg Row 1 of 10.
Can this be changed to display row no of currently selected row insted of first row?
Thanks in advance,
Apurva.Hi ,
You would not be able to extend the UI per se..
Instead you can make use of the property "firstVisibleRow" and "visiblerows" .
When a user clicks a button to bring down the entries by one
- increase the firstvisiblerow property by 1
when he wants to move to next page ,
- increase the firstvisiblerow property to firstvisiblerow+visiblerows
Use the table toolbar for scrolling..and placing your elements as it would always be properly aligned to your table..
Regards
Bharathwaj.. -
Display of row index in table footer
Hi,
Row no of first row is generally displayed in the footer of the table as
Row <first row rowno> of <total no of rows>.Eg Row 1 of 10.
Can this be changed to display row no of currently selected row insted of first row?
Thanks in advance,
Apurva.Hi ,
You would not be able to extend the UI per se..
Instead you can make use of the property "firstVisibleRow" and "visiblerows" .
When a user clicks a button to bring down the entries by one
- increase the firstvisiblerow property by 1
when he wants to move to next page ,
- increase the firstvisiblerow property to firstvisiblerow+visiblerows
Use the table toolbar for scrolling..and placing your elements as it would always be properly aligned to your table..
Regards
Bharathwaj.. -
My final data table contains a two key columns unique key constraint. I insert data into this table from a daily capture table (which also contains the two columns that make up the key in the final data table but are not constrained
(not unique) in the daily capture table). I don't want to insert rows from daily capture which already exists in final data table (based on the two key columns). Currently, what I do is to select * into a #temp table from the join
of daily capture and final data tables on these two key columns. Then I delete the rows in the daily capture table which match the #temp table. Then I insert the remaining rows from daily capture into the final data table.
Would it be possible to simplify this process by using an Instead Of trigger in the final table and just insert directly from the daily capture table? How would this look?
What is the best practice for inserting unique (new) rows and ignoring duplicate rows (rows that already exist in both the daily capture and final data tables) in my particular operation?
Rich PPlease follow basic Netiquette and post the DDL we need to answer this. Follow industry and ANSI/ISO standards in your data. You should follow ISO-11179 rules for naming data elements. You should follow ISO-8601 rules for displaying temporal data. We need
to know the data types, keys and constraints on the table. Avoid dialect in favor of ANSI/ISO Standard SQL. And you need to read and download the PDF for:
https://www.simple-talk.com/books/sql-books/119-sql-code-smells/
>> My final data table contains a two key columns unique key constraint. [unh? one two-column key or two one column keys? Sure wish you posted DDL] I insert data into this table from a daily capture table (which also contains the two columns that make
up the key in the final data table but are not constrained (not unique) in the daily capture table). <<
Then the "capture table" is not a table at all! Remember the fist day of your RDBMS class? A table has to have a key. You need to fix this error. What ETL tool do you use?
>> I don't want to insert rows from daily capture which already exists in final data table (based on the two key columns). <<
MERGE statement; Google it. And do not use temp tables.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
How to get row count(*) for each table that matches a pattern
I have the following query that returns all tables that match a pattern (tablename_ and then 4 digits). I also want to return the row counts for these tables.
Currently a single column is returned: tablename. I want to add the column RowCount.
DECLARE @SQLCommand nvarchar(4000)
DECLARE @TableName varchar(128)
SET @TableName = 'ods_TTstat_master' --<<<<<< change this to a table name
SET @SQLCommand = 'SELECT [name] as zhistTables FROM dbo.sysobjects WHERE name like ''%' + @TableName + '%'' and objectproperty(id,N''IsUserTable'')=1 ORDER BY name DESC'
EXEC sp_executesql @SQLCommandThe like operator requires a string operand.
http://msdn.microsoft.com/en-us/library/ms179859.aspx
Example:
DECLARE @Like varchar(50) = '%frame%';
SELECT * FROM Production.Product WHERE Name like @Like;
-- (79 row(s) affected)
For variable use, apply dynamic SQL:
http://www.sqlusa.com/bestpractices/datetimeconversion/
Rows count all tables:
http://www.sqlusa.com/bestpractices2005/alltablesrowcount/
Kalman Toth Database & OLAP Architect
SQL Server 2014 Design & Programming
New Book / Kindle: Exam 70-461 Bootcamp: Querying Microsoft SQL Server 2012 -
The biggest count of rows of sys tables
Hii ??
I want to learn how can I find the biggest count of rows of sys tables or
which table has around 900000 records on sys user database oracle 10g??Hello;
What purpose would knowing the row count in tables owned by SYS serve ? The query below will give you a fair idea of row counts in tables owned by SYS assuming that statistics have been recently gathered for these tablesselect table_name,num_rows from dba_tables where owner='SYS';Varad -
Row/column counter for tables
Hello,
I know this is very basic, but so far examples I dug up don't really anything remotely to what I want.
I have 3 databases. Well they are defined as "connections" in SQLDeveloper I hope that's the same I am still not used to Oracle abstractions.
Each has several tables. All I want is loop through each of the 3 DBs and log row count and table count.
Say DB1:
Rows: Columns:
Table1: x y
Table2: x y
I don't really care what's inside them. I found one example that did it but it listed some system tables that aren't part of my db. Changing "owner" didn't really help.
From the value of the variable "Owner" means a database, is that correct?
Oh and I also don't care if the code is "inefficient", tables aren't that big.
Thanks in advance.
Edited by: 940349 on Jun 14, 2012 6:22 AMnot sure what you are planning to achieve, but you can use below query to get owner of table, table name , column name, number of tables by owner and number of column in a table (belonging to owner). This will require access to dba_tab_columns.
select owner,table_name,count(*) over(partition by owner) count_table,column_name,count(*) over(partition by owner,table_name) count_column from dba_tab_columns; -
Subtotal in Table Footer Appears in Body on the Next Page - Smartform
Hi experts,
I have a subtotal row in my table footer. It works find (appears correctly for each page). But when I check the body of the table, in page 2, there is a line with the subtotal amount from page 1, appearing in line 2. Do you guys know why does this happen and how to solve it?
Thanks,
SamHi Sam,
1. Can you cross check whether you have coded anything which will modify the internal table content with the subtotal value?
2. Did you keep any condition like printing the sub total at each new value for a particular field
(Eg: If there is a field f1 in your internal table with values a, a, a, b, b, b, d, d, d - is there any condition to print sub total when f1value changes from a to b or b to d ? )
Regards,
Swarna Munkoti. -
Dynamic row counter column in Adobe Forms
Hi Guys,
My table in Adobe Forms is dynamically created with Conditional Breaks. I want to display 1st column as Sr.No. displaying row counter for tables on each page.
Anyone have idea how to achieve the same.
Sr.No
Name
Address
1 (generated in adobe forms dynamically)
xyz
awsaxa sadsad
2 (generated in adobe forms dynamically)
abc
asds sad ads
so on......
Regards,
NaveenHi Guys,
Not able to find any counter variable for table. So what I did is inserted the counter logically before calling Adobe forms driver program.
FYI.
Regards,
Naveen -
How to return mismatched rows from two tables?
I have created two tables in the same database as below which gives the row
count of tables across all databases before and after an DB restore
operation.
create table before_restore(db_name varchar(100),table_name
varchar(1000),row_count int) insert into before_restore exec sp_msforeachdb 'USE
[?]; select ''?'' as database_name,o.name,max(i.rowcnt ) From [?].sys.objects o
inner join [?].sys.sysindexes i on o.object_id=i.id where o.type=''U'' group by
o.name'
create table after_restore(db_name varchar(100),table_name
varchar(1000),row_count int) insert into after_restore exec sp_msforeachdb 'USE
[?]; select ''?'' as database_name,o.name,max(i.rowcnt ) From [?].sys.objects o
inner join [?].sys.sysindexes i on o.object_id=i.id where o.type=''U'' group by
o.name'
I want to compare these two tables and it should only return me rows that
have changed after the restore operation is complete.
Eg:
Table xyz has rowcount of 100 before restore and the restore was not proper
and after restore count is 50. So it should return me the result set as
below;
Db_name Table_Name row_count_before_restore row_count_after_restore
abc xyz 100
50
Thanks!!!Something like below perhaps? Btw, I recommend using catalog view and dynamic management views instead of the old system tables (now called compatibility views)...
SELECT
COALESCE(a.db_name, b.db_name) AS db_name
,COALESCE(a.table_name, b.table_name) AS table_name
,a.row_count AS row_count_before_restore
,b.row_count AS row_count_after_restore
FROM before_restore AS b FULL OUTER JOIN after_restore AS a ON b.db_name = a.db_name AND b.table_name = a.table_name
WHERE b.row_count <> a.row_count OR b.db_name IS NULL OR a.db_name IS NULL
Tibor Karaszi, SQL Server MVP |
web | blog -
Unique row based on two columns and single column
Dear Members,
I have a table which contains duplicate rows, for which a query should be able to fetch the unique row from the table. Here the unique is not based on one column, but it should be on two columns and also check for uniqueness on one column.
create table addr ( firstname varchar2(10), lastname varchar2(10), area varchar2(3));
insert into addr values('bob', 'james', '1');
insert into addr values('bob', 'james', '1');
insert into addr values('harry', 'bert', '1');
insert into addr values('jimmy', 'bert', '1');
insert into addr values('sam', 'mac', '1');
insert into addr values('sam', 'knight', '1');
insert into addr values('tom', 'sand', '1');
insert into addr values('cat', 'mud', '1');
The output of query should contain 3 rows.
bob - james
harry - bert or jimmy - bert [ either one of them, but not both ]
sam - mac or sam - knight [ either one of them, but not both ]
tom - sand
cat - mud
SELECT firstname, lastname as total from addr WHERE area = '1' GROUP by firstname,lastname; This does not take of single column duplication..
Any suggestions..SQL> with t_data
as
select 'bob' as firstname, 'james' as lastname, '1' as area from dual union all
select 'bob', 'james', '1' from dual union all
select 'harry', 'bert', '1' from dual union all
select 'jimmy', 'bert', '1' from dual union all
select 'sam', 'mac', '1' from dual union all
select 'sam', 'knight', '1' from dual union all
select 'tom', 'sand', '1' from dual union all
select 'cat', 'mud', '1' from dual
SELECT
firstname,
lastname,
area
FROM
SELECT
t.*,
row_number() over(partition BY firstname order by 1) rn,
row_number() over(partition BY lastname order by 1) rn1
FROM
t_data t
WHERE
rn = 1
AND rn1 =1 ;
FIRSTNAME LASTNAME AREA
bob james 1
cat mud 1
jimmy bert 1
sam knight 1
tom sand 1
SQL>
Maybe you are looking for
-
HOW DO YOU CONVET AN ORACLE DATABASE FILE TO A TXT FILE?
Is there a way in a program unit of a form to convert an ORACLE database file into TXT format? When the file gets created, I want to use the text file in a distribution list for sending email. My code in the program unit is: Insert into THE_IMO_EMAIL
-
JDBC to SOAP to trigger Web Service in PI XI
Hello Experts, My scenario is: SystemA - > JDBC adapter - > PI - > SOAP Adapter - > SAP. Sender side (JDBC) works file, I can see the payload in the sender structure and the converted payload for the receiver side. I am testing the webservice using t
-
EPM and EVDRE sorting changed in BPC 10
We feel that the expand function on base level (BAS) in both EPM and EVDRE have been changed from 7.5 to BPC 10. It is the sorting of members that we feel is wrong. It is not expanding on the order of the dimension but on what hierarchy level order t
-
Ipad 3 Wifi connectivity issues on IOS8
Hi everyone, just wondering if anyone else has experienced wifi issues with ipad 3 (the retina late 2012 version). even right next to my router i keep losing connection and every time i turn on and off from sleep i need to disconnect and connect wifi
-
PIN to unlock my previous phone
Verizon Support - Before upgrading to my Apple iPhone last year, I had an LG VS920ZV8 4G phone with Android System 4.0.4 I would like to know if you can provide me with a PIN number and instructions to unlock the LG Phone? Thank you.