Home » Developer & Programmer » Reports & Discoverer » count stuid
count stuid [message #669220] |
Mon, 09 April 2018 08:11  |
shahzad-ul-hasan
Messages: 643 Registered: August 2002
|
Senior Member |
|
|
SQL>desc student
Name Null? Type
----------------------------------------- -------- ---------------
STUID NOT NULL NUMBER(8)
STATUS VARCHAR2(30)
CLASS VARCHAR2(25)
SECTION VARCHAR2(30)
NAME VARCHAR2(250)
F_NAME VARCHAR2(250)
DOA DATE
DOB DATE
i want to count no of student on specific date.My total strength on '26-DEC-2017' is 1234. and the system showing 1084.i am using this query.
SQL> select count(stuid) from student
2 where status='PRESENT'
3 AND DOA <'26-DEC-2017';
COUNT(STUID)
------------
1084
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: count stuid [message #675537 is a reply to message #669243] |
Thu, 04 April 2019 04:04   |
shahzad-ul-hasan
Messages: 643 Registered: August 2002
|
Senior Member |
|
|
CREATE TABLE STUDent (
stuid number(6) primary key,status varchar2(20),doa date,leav_date date);
insert into STUDent (stuid,status,doa,leav_date)
values
(1,'PRESENT','03-APR-2017','03-APR-2019');
insert into STUDent (stuid,status,doa,leav_date)
values
(2,'N_PRESENT','23-APR-2017','03-MAY-2019');
insert into STUDent (stuid,status,doa,leav_date)
values
(3,'PRESENT','03-APR-2017','');
insert into STUDent (stuid,status,doa,leav_date)
values
(4,'PRESENT','23-APR-2017','');
insert into STUDent (stuid,status,doa,leav_date)
values
(5,'PRESENT','13-APR-2017','');
insert into STUDent (stuid,status,doa,leav_date)
values
(6,'N_PRESENT','15-MAY-2017','03-APR-2019');
insert into STUDent (stuid,status,doa,leav_date)
values
(7,'N_PRESENT','03-APR-2017','03-APR-2019');
insert into STUDent (stuid,status,doa,leav_date)
values
(8,'N_PRESENT','23-MAR-2017','03-MAY-2019');
insert into STUDent (stuid,status,doa,leav_date)
values
(9,'PRESENT','03-MAR-2016','');
insert into STUDent (stuid,status,doa,leav_date)
values
(10,'PRESENT','23-OCT-2018','');
insert into STUDent (stuid,status,doa,leav_date)
values
(11,'PRESENT','13-SEP-2017','');
insert into STUDent (stuid,status,doa,leav_date)
values
(12,'PRESENT','15-JUL-2018','');
insert into STUDent (stuid,status,doa,leav_date)
values
(13,'PRESENT','03-APR-2018','');
Quote:
SELECT distinct COUNT(STUDENT.STUID) str FROM STUDENT
WHERE STATUS='PRESENT'
and doa < :p_1
But cannot get the required result.
Quote:
Result Required:
Date nO OF sTUDENT
12-JAN-2019 5
13-JAN-2019 7
14-JAN-2019 6
22-JAN-2019 7
23-JAN-2019 7
28-JAN-2019 8
ON SPECIFIC DATE whether the student is Present or N_Present. shows the equal strength. if a student is present on a date(12-jan-2019) and leave the school after the enter date on (13-Jan-2019). when i check (13-jan-2019) it will not show that student. when i check (12-jan-2019) it will show that student.
[Updated on: Thu, 04 April 2019 04:12] Report message to a moderator
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri May 30 12:15:33 CDT 2025
|