The statement used to count the number of men and women in a franchise store in the oracle database to help you
The statement used to count the number of men and women in a franchise store in the oracle database to help you
Web_THBC indicates the presentation layer, that is, the page (. aspx)
BLL_THBC is the business logic layer
DAL_THBC is the database interaction layer (Execute SQL statements to the database)
Model_THBC is an entity class.
DbHelper is the database connection class
Count the number of men and women in a franchise store
The Code is as follows:
Select dua. UARTERS_ID, dua. UARTERS_NAME
, Sum (case when sex = '1' then 1 else 0 end) as Man
, Sum (case when sex = '0' then 1 else 0 end) as Woman
From dbo. DCAD_USER as du
Left join
Dbo. DCAD_UARTERS as dua
On du. UARTERS_ID = dua. UARTERS_ID
Group by dua. UARTERS_ID, dua. UARTERS_NAME
Author: ershouyage