Home > Enterprise >  How to make this query to one?
How to make this query to one?

Time:11-21

select count(memberid) cnt from memberdata where MemberID;

select count(Deleted) UnUsable from memberdata where deleted = 1;

select count(Deleted) Usable from memberdata where deleted = 0;

Question How to make this query to one?

CodePudding user response:

You can use a query like this

SELECT
  count(memberid) AS cnt,
  count(Deleted = 1) AS UnUsabl,
  count(Deleted = 0) AS Usable
FROM memberdata;

CodePudding user response:

As both query zo count the deletd are independent of the WHERE clause

make some suqueries of them

select 
count(memberid) cnt
,(SELECT count(deleted = 1) FROM memberdata) UnUsable
, (SELECT count(deleted = 0) FROM memberdata) Usable 
from memberdata where MemberID;
  • Related