Click here to Skip to main content
15,896,912 members

Comments by varsh12 (Top 5 by date)

varsh12 27-Feb-21 11:45am View    
Now i want to return only those records which satisfied the condition.
category 16 count < 5000 and category 24 count < 1000 then print both but not 35
if category 24 and 35 count is < 1000 but category 16 count > 5000, then return only 24 and 35. like this.
i tried below but multiple oracle errors happening.

DECLARE count_1 number := 5000; Count_2 number:= 1000 ; beginIF (count_1< (SELECT count(*)    FROM staff n    WHERE n.category = 16    GROUP BY n.category) and   (Count_2 < (SELECT count(*)    FROM staff n<pre lang="text">
    WHERE n.category in (2,3) GROUP BY n.category)))
    then 
    select category,count_1 as count from staff where category in (1,2,3);
    
    else 
    (count_1 > (SELECT count(*)
    FROM staff n
    WHERE n.category = 1 GROUP BY n.category) and   (Count_2< (SELECT count(*)
    FROM staff n
    WHERE n.category in (2,3) GROUP BY n.category)))
    --then
    select category,count_1 as count from staff where category in (1,2,3);
 end if;
 end; 
varsh12 27-Feb-21 10:17am View    
Yes. if I want to show only those row which is fulfill not all. Any help.
Like if category 16 and 35 are fulfill, then return only those 2 rows.
varsh12 27-Feb-21 7:45am View    
Thanks Maciej Los
varsh12 19-Jun-19 7:14am View    
count(*) store some numeric value like 100, 200
varsh12 7-Jan-19 2:06am View    
Thanks for the update. But I am getting Invalid Identifier error for "DBMS_LOB.INSTR"