473,396 Members | 1,749 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Count multiple items from the same column

5
Hi All,
I need to do a count of individual items in one column I call status. The status column contains only three values (‘Not Available’, Partially Available’, ‘Fully Available’). My sql statement below just gets me the count for the status column, I need to know how to count the status column for the specific items.

SELECT EEI.EEI_NAME, COUNT(EEI_INSTANCE_RECOVERY.STATUS) AS EXPR1
FROM MTS_EVENT INNER JOIN EEI_INSTANCE_RECOVERY
ON MTS_EVENT.EVENT_ID = EEI_INSTANCE_RECOVERY.EVENT_ID
INNER JOIN EEI_OBJECT_INSTANCE
ON EEI_INSTANCE_RECOVERY.INSTANCE_ID = EEI_OBJECT_INSTANCE.INSTANCE_ID
INNER JOIN EEI ON EEI_OBJECT_INSTANCE.EEI_ID = EEI.EEI_ID
WHERE (EEI.EEI_TYPE = 'Critical Infrastructure')
AND (EEI_INSTANCE_RECOVERY.EVENT_ID = :EVENT_ID)
GROUP BY EEI.EEI_NAME ORDER BY EEI.EEI_NAME ASC

The results from this query gets me part way there, it returns is like

EEI_NAME EXPR1
Name_one.........8
Name_two.........5

My goal is to have it return

EEI_NAME EXPR1 Not_Available Partially_Available Fully_Availavle
Name_one....... 8 ..............2 ........................2...................... 4
Name_two........5...............0 ........................0 ......................5

Thank you for any help!
Oct 16 '07 #1
2 2322
debasisdas
8,127 Expert 4TB
Try to use COUNT and SUM with DECODE.

That will solve your problem.
Oct 17 '07 #2
redeye
5
Thank You,
It worked great.
Oct 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: keith | last post by:
I am trying to get a exact count of different distinct entries in an Access column. At first, I was trying to work with three columns, but I've narrowed it down to one to simplify it. I've searched...
2
by: cefrancke | last post by:
I can't seem to find a straight answer for my specific issue. Any help would be appreciated. I would like to count the various items in a table where the fields have a 'group' relationship. I...
0
by: chris.bender | last post by:
1. My problem: I am using a query to populate a Chart in MS Access 2k. 2. My query: SELECT .Status, ., Sum(.Amount) AS SumOfAmount, Sum(IIf(!="Debit",!,!*-1)) AS realAmount, Count(.Status) AS...
1
by: heckstein | last post by:
I am working in Access 2002 and trying to create a report from our company's learming management system. I am not a DBA and most of my SQL knowledge has been self taught through trial and error. I...
2
by: AZKing | last post by:
Hi, I am creating a query where I would like to count the number of specific items in a certain column of another query. I can do this for one item, for example: SELECT DISTINCTROW., Count(.)...
1
by: michael.martinek | last post by:
Greetings! I've recently been trying to do something, which apparently looks like it may be a little odd.. I'm not finding anything in the manuals or anywhere on the web where something similiar...
5
by: Genalube | last post by:
I am trying to count the number of owners that show up in a query (conveyQuery). The query will produce a column OwnName that will contain names like John Smith, Mike Jones, Frank Vaugn. Each of...
1
by: nospam | last post by:
I have a report to count some statistics of case data. I can't figure out how to make Access group and sum/count information to give me a nice statistics report. Basically the database has case...
1
by: KrazyKasper | last post by:
Access 2003 – Multi-Column List Box – Select Multiple Items I have a multi-column (3 columns) list box that works well to select one set of records or all sets of records (based on the first field...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.