- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Oracle Query Help
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2003 10:17 AM
тАО07-02-2003 10:17 AM
Oracle Query Help
Structure
Cus_num,Savings,Checking,Funds
Data
C100,1,0,0 (1 means customer has that account)
C200,0,1,0
C300,0,0,1
C400,0,1,0
C500,1,0,0
How to find out (need a query),
how many customers have savings
how many customers have checking
how many customers have funds
Thanks
Raj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2003 10:24 AM
тАО07-02-2003 10:24 AM
Re: Oracle Query Help
If I understood your question correctly then,
select count(*) from customers where savings=1
select count(*) from customers where checking=1
select count(*) from customers where funds=1
will do.
HTH,
Umapathy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2003 12:05 PM
тАО07-02-2003 12:05 PM
Re: Oracle Query Help
select checking,count(*) from table group by checking;
select funds,count(*) from table group by funds;
You could also do something like:
select savings,checking,funds,count(*) from table group by savings,checking,funds;
This would give you a tabular count of customers with different forms of accounts (ie: customers with savings and checking). You should get 9 rows.
If you need something more specific, post back with exact details.
Thanks,
Brian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-02-2003 08:34 PM
тАО07-02-2003 08:34 PM
Re: Oracle Query Help
As brian said above, quite difficult to help here unless you feed us additional information.
Anyway, if you are trying to write a query that satisfies all these criteria, you should should have a where condition:
select count (*)
from customers
where savings >1
and checking > 1
and funds >1;
regards
Yogeeraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО07-03-2003 03:51 AM
тАО07-03-2003 03:51 AM
Re: Oracle Query Help
How about something like:
SELECT
SUM (CASE WHEN SAVINGS > 0 AND SAVINGS IS NOT NULL THEN 1 ELSE 0 END) as "Number with savings",
SUM (CASE WHEN CHECKING > 0 AND CHECKING IS NOT NULL THEN 1 ELSE 0 END) as "Number with checking",
SUM (CASE WHEN FUNDS > 0 AND FUNDS IS NOT NULL THEN 1 ELSE 0 END) as "Number with funds"
FROM YOUR_TABLE