select column_name, count(column_name)
from table
group by column_name
having count (column_name) > 1;
Sunday, September 28, 2014
Oracle : find duplicate row and total duplicate
Monday, September 1, 2014
Oracle : display all date in month
Here some example for show all date in current/before/after month or specific month
Above is current month
select to_char( add_months(trunc(sysdate,'MM'),-1) + level - 1, 'YYYYMMDD' ) from dual connect by level <= last_day(add_months(trunc(sysdate,'MM'),-1)) - add_months(trunc(sysdate,'MM'),-1) + 1;Above is before current month
select to_char( add_months(trunc(sysdate,'MM'),1) + level - 1, 'YYYYMMDD' ) from dual connect by level <= last_day(add_months(trunc(sysdate,'MM'),1)) - add_months(trunc(sysdate,'MM'),1) + 1;Above is after current month
select to_char( trunc(sysdate,'MM') + level - 1, 'YYYYMMDD' ) from dual connect by level <= last_day(trunc(sysdate,'MM')) - trunc(sysdate,'MM') + 1;
Above is current month
select to_char( trunc(to_date('20140101','YYYYMMDD'),'MM') + level - 1, 'YYYYMMDD' ) from dual connect by level <= last_day(trunc(to_date('20140101','YYYYMMDD'),'MM')) - trunc(to_date('20140101','YYYYMMDD'),'MM') + 1;Above is specific month but you must enter date.
Subscribe to:
Posts (Atom)