make view table create use if conditation
up vote
0
down vote
favorite
i am using codeigniter. i want to cout like this if i found 1 subject = fail
then all result =f/fail . i how write query. i use group by
beasue 1 stuent have many class data .
My table
How can write this query . i want to if one or many subject get fail mean f .
then getMark =f or getMark = 4.40 like .
Query
CREATE VIEW result as SELECT name as name,roll as roll,class as
class,subject_name as subject,exam_type as exam_type,sum(full_mark) as
full_mark,sum(getmark) as getmark, if(gpa =='f', 'F',sum(gpa)) as
total_gpa FROM mark GROUP by roll,class,exam_type
php mysql codeigniter mysqli
add a comment |
up vote
0
down vote
favorite
i am using codeigniter. i want to cout like this if i found 1 subject = fail
then all result =f/fail . i how write query. i use group by
beasue 1 stuent have many class data .
My table
How can write this query . i want to if one or many subject get fail mean f .
then getMark =f or getMark = 4.40 like .
Query
CREATE VIEW result as SELECT name as name,roll as roll,class as
class,subject_name as subject,exam_type as exam_type,sum(full_mark) as
full_mark,sum(getmark) as getmark, if(gpa =='f', 'F',sum(gpa)) as
total_gpa FROM mark GROUP by roll,class,exam_type
php mysql codeigniter mysqli
Sharing the table schema would help and a sample data with couple of rows.
– CS_noob
Nov 9 at 5:35
check i add table photo
– Hasan Sheikh
Nov 9 at 8:34
Have you tried CASE statements.?
– CS_noob
Nov 9 at 14:30
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
i am using codeigniter. i want to cout like this if i found 1 subject = fail
then all result =f/fail . i how write query. i use group by
beasue 1 stuent have many class data .
My table
How can write this query . i want to if one or many subject get fail mean f .
then getMark =f or getMark = 4.40 like .
Query
CREATE VIEW result as SELECT name as name,roll as roll,class as
class,subject_name as subject,exam_type as exam_type,sum(full_mark) as
full_mark,sum(getmark) as getmark, if(gpa =='f', 'F',sum(gpa)) as
total_gpa FROM mark GROUP by roll,class,exam_type
php mysql codeigniter mysqli
i am using codeigniter. i want to cout like this if i found 1 subject = fail
then all result =f/fail . i how write query. i use group by
beasue 1 stuent have many class data .
My table
How can write this query . i want to if one or many subject get fail mean f .
then getMark =f or getMark = 4.40 like .
Query
CREATE VIEW result as SELECT name as name,roll as roll,class as
class,subject_name as subject,exam_type as exam_type,sum(full_mark) as
full_mark,sum(getmark) as getmark, if(gpa =='f', 'F',sum(gpa)) as
total_gpa FROM mark GROUP by roll,class,exam_type
php mysql codeigniter mysqli
php mysql codeigniter mysqli
edited Nov 9 at 16:10
asked Nov 9 at 3:46
Hasan Sheikh
4412
4412
Sharing the table schema would help and a sample data with couple of rows.
– CS_noob
Nov 9 at 5:35
check i add table photo
– Hasan Sheikh
Nov 9 at 8:34
Have you tried CASE statements.?
– CS_noob
Nov 9 at 14:30
add a comment |
Sharing the table schema would help and a sample data with couple of rows.
– CS_noob
Nov 9 at 5:35
check i add table photo
– Hasan Sheikh
Nov 9 at 8:34
Have you tried CASE statements.?
– CS_noob
Nov 9 at 14:30
Sharing the table schema would help and a sample data with couple of rows.
– CS_noob
Nov 9 at 5:35
Sharing the table schema would help and a sample data with couple of rows.
– CS_noob
Nov 9 at 5:35
check i add table photo
– Hasan Sheikh
Nov 9 at 8:34
check i add table photo
– Hasan Sheikh
Nov 9 at 8:34
Have you tried CASE statements.?
– CS_noob
Nov 9 at 14:30
Have you tried CASE statements.?
– CS_noob
Nov 9 at 14:30
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53219569%2fmake-view-table-create-use-if-conditation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Sharing the table schema would help and a sample data with couple of rows.
– CS_noob
Nov 9 at 5:35
check i add table photo
– Hasan Sheikh
Nov 9 at 8:34
Have you tried CASE statements.?
– CS_noob
Nov 9 at 14:30