Home » SQL & PL/SQL » SQL & PL/SQL » COUNTING THE DISTINCT OCCURENCE OF DATA FROM MULTIPLE COLUMNS (Oracle 10g, Win7)
COUNTING THE DISTINCT OCCURENCE OF DATA FROM MULTIPLE COLUMNS [message #576431] Mon, 04 February 2013 22:51 Go to next message
nischalinn
Messages: 117
Registered: May 2012
Location: nepal
Senior Member
CREATE TABLE FEB05
 (NAME VARCHAR2(20),
 CITY VARCHAR2(20))

  INSERT INTO FEB05 VALUES ('AKON','CIT22')
  INSERT INTO FEB05 VALUES ('MARIA','WOT101');
  INSERT INTO FEB05 VALUES ('GEORGE','NYK580');
  INSERT INTO FEB05 VALUES ('JULIA','NYK580');
  INSERT INTO FEB05 VALUES ('MAVEN','CIT22');
  INSERT INTO FEB05 VALUES ('MARIA','LA370');
  INSERT INTO FEB05 VALUES ('JULIA','CIT22') ;
  INSERT INTO FEB05 VALUES ('JULIA','BOSTON055') ;
  INSERT INTO FEB05 VALUES ('KATY','CIT22');


I WANT A QUERY THAT WILL GIVE O/P AS TO GET DISTINCT COUNT OF NAME AND CITY COLUMN seperately.
I.E. THE O/P SHOULD BE


Quote:
Count(dist name) Count(dist city)
6 5

Re: COUNTING THE DISTINCT OCCURENCE OF DATA FROM MULTIPLE COLUMNS [message #576433 is a reply to message #576431] Tue, 05 February 2013 00:05 Go to previous messageGo to next message
Littlefoot
Messages: 19347
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
What prevents you to translate this:
Quote:
count(dist name) Count(dist city)
into valid Oracle SQL syntax?
Re: COUNTING THE DISTINCT OCCURENCE OF DATA FROM MULTIPLE COLUMNS [message #576435 is a reply to message #576431] Tue, 05 February 2013 00:17 Go to previous messageGo to next message
Michel Cadot
Messages: 58641
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Do not post in UPPER case.
End ALL your statements with a ";".

Regards
Michel
Re: COUNTING THE DISTINCT OCCURENCE OF DATA FROM MULTIPLE COLUMNS [message #576511 is a reply to message #576435] Tue, 05 February 2013 14:54 Go to previous messageGo to next message
Bill B
Messages: 1069
Registered: December 2004
Senior Member
A hint, dist => distinct

Now write the sql statement

[Updated on: Tue, 05 February 2013 14:55]

Report message to a moderator

Re: COUNTING THE DISTINCT OCCURENCE OF DATA FROM MULTIPLE COLUMNS [message #576522 is a reply to message #576511] Tue, 05 February 2013 15:56 Go to previous messageGo to next message
Littlefoot
Messages: 19347
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
That's some strange topic. I'd swear I saw at least two solutions here today, but none of them survived the night ...
Re: COUNTING THE DISTINCT OCCURENCE OF DATA FROM MULTIPLE COLUMNS [message #576787 is a reply to message #576511] Thu, 07 February 2013 23:51 Go to previous message
nischalinn
Messages: 117
Registered: May 2012
Location: nepal
Senior Member
@Bill B

Thank You for the reply.
Previous Topic: Data Purging
Next Topic: Need to find fast
Goto Forum:
  


Current Time: Fri Aug 01 05:16:50 CDT 2014

Total time taken to generate the page: 0.04497 seconds