PL/SQL (MOSC)

MOSC Banner

count rows in one table that is related to another table

edited Oct 31, 2012 12:18PM in PL/SQL (MOSC) 7 commentsAnswered
 I have a systems table which contains a "systemtype" , "narserno".  also I have a luns table which has "narserno" and luninfo field. 

for each systemtype, I want to count total in the systems table where luninfo in the luns table contains a key work of "oracle".  

I have this query, but it doesnt look right (too many value returns),  could you one point out where my problem is:

select systemtype, count(l.luninfostring) counts from systemconfig s, lunperformancesummary l 
where s.narserno=l.arrayid and l.luninfostring like '%oracle%' group by systemtype
order by counts desc;

Thanks,
CP

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center