Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old March 31st, 2004, 11:56 PM
YuLing YuLing is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 44 YuLing User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via ICQ to YuLing
Cool How to count and display it like this?

Hi anyone can help me out please...

Say that i have this tables
my_table1
loc_name


i have this simple code to count numbers of record in the table
select loc_name, count(*)
from my_table1
where loc_name='S'
group by loc_name

it will display something like this
loc_name count(*)
S 4

if i wan to count another separate loc_name='E' and at the end have a count to count the sum of both 'S' and 'E' and display it like this how do i do it
loc_name count(*)
S 4
E 8
**********************************
sum 12

thank you

Reply With Quote
  #2  
Old April 1st, 2004, 08:46 AM
shafique shafique is offline
Senior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Canada
Posts: 305 shafique User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 45 m 20 sec
Reputation Power: 5
Use the following SQL*Plus command:
SQL>break on report
SQL>compute sum label Total of count on report

now run your query like that:

select loc_name, count(*) count
from my_table1
where loc_name in ('S','E')
group by loc_name

Reply With Quote
  #3  
Old April 1st, 2004, 06:46 PM
YuLing YuLing is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 44 YuLing User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
Send a message via ICQ to YuLing
Thanks a lot

Thank you so much...it does exactly wat i want

Reply With Quote
  #4  
Old July 14th, 2004, 01:57 PM
katman5903 katman5903 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2003
Posts: 16 katman5903 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Try using qlr manager. It supports both Oracle and MySQL database reporting. It will allow you to write and save both queries and layouts (layouts format your output). It will easily handle this type of formatting.

Katman

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > How to count and display it like this?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway