0

I'm trying to get output from :

select count(r.id) and count(r.key) from rules r where lower(r.name) in ('xss attack','dos attack') ;

but getting error like

ORA-00923: FROM keyword not found where expected

3
  • What happens if you try select count(r.id), count(r.key) from rules r where lower(r.name) in ('xss attack','dos attack') ; Commented Jun 2, 2017 at 2:35
  • please check my answer which i replied for above question and what I'm expecting @ProgrammersBlock Commented Jun 2, 2017 at 2:58
  • the and in your select list is causing your original problem. Look at Renato's answer below for correct syntax. Commented Jun 2, 2017 at 14:58

2 Answers 2

2

Something like this? :

select count(r.id),count(r.key) from rules
where lower(r.name) in ('xss attack','dos attack')
Sign up to request clarification or add additional context in comments.

Comments

0

I tried below solution :

select (select count(r.id) from rules r where lower(r.name) in ('xss attack','dos attack')) AS name,(select count(r.key) from rules r where lower(r.name) in ('xss attack','dos attack')) AS name from rules;

Please correct me if any improvement is required for above query.

Output I'm getting is like

NAME   NAME

 2      2
 2      2

while i expect my output should like as

NAME        NAME
 2            2

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.