Count row with month and other conditionCan I concatenate multiple MySQL rows into one field?Getting the number of rows with a GROUP BY queryLooking for a mysql query to count all rows previous to last monthmysql select the count of records for every monthCounts the occurrence of data in table1 based on presence of same data in table2 and group summary by year and monthCounting number of grouped rows in mysqlSQL Query : Order In monthHow to display tree results count by each month?Selecting rows of data into monthsMysql select where in() for each id return equal rows count

Magical attacks and overcoming damage resistance

What is the best way to deal with NPC-NPC combat?

Do I need to watch Ant-Man and the Wasp and Captain Marvel before watching Avengers: Endgame?

"My boss was furious with me and I have been fired" vs. "My boss was furious with me and I was fired"

Rudin 2.10 (b) Example

Which big number is bigger?

How can I practically buy stocks?

All ASCII characters with a given bit count

Find the identical rows in a matrix

Mistake in years of experience in resume?

Why is the underscore command _ useful?

Is there really no use for MD5 anymore?

Creating a chemical industry from a medieval tech level without petroleum

Zonal Statistics is returning null values in ArcGIS

Drawing a german abacus as in the books of Adam Ries

How do I deal with a coworker that keeps asking to make small superficial changes to a report, and it is seriously triggering my anxiety?

My admission is revoked after accepting the admission offer

A strange hotel

How do I reattach a shelf to the wall when it ripped out of the wall?

Can a barbarian keep raging if she shoves an enemy on her turn?

How to pronounce 'c++' in Spanish

std::unique_ptr of base class holding reference of derived class does not show warning in gcc compiler while naked pointer shows it. Why?

How long after the last departure shall the airport stay open for an emergency return?

Retract an already submitted recommendation letter (written for an undergrad student)



Count row with month and other condition


Can I concatenate multiple MySQL rows into one field?Getting the number of rows with a GROUP BY queryLooking for a mysql query to count all rows previous to last monthmysql select the count of records for every monthCounts the occurrence of data in table1 based on presence of same data in table2 and group summary by year and monthCounting number of grouped rows in mysqlSQL Query : Order In monthHow to display tree results count by each month?Selecting rows of data into monthsMysql select where in() for each id return equal rows count






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I know we can count rows easily, but i have some problem doing that.



this is my table



I tried to count row where the value is not equal to '-' in each month. This query below counts all row in all months.



SELECT MONTHNAME(tanggal) as bulan,
(SELECT COUNT(iad) FROM triwulan WHERE iad!='-') as iadp,
(SELECT COUNT(isk) FROM triwulan WHERE isk!='-') as isk,
(SELECT COUNT(vap) FROM triwulan WHERE vap!='-') as vap,
(SELECT COUNT(hap) FROM triwulan WHERE hap!='-') as hap,
(SELECT COUNT(plebitis) FROM triwulan WHERE plebitis!='tidak') as plebitis
FROM `triwulan`
group by bulan


I would appreciate any help, thank you..










share|improve this question



















  • 1





    This kind of problem is symptomatic of poor design. Consider having one infection_type column, with a row for each infection type.

    – Strawberry
    Mar 9 at 8:36











  • Besides, if someone recovers from isk, but still has vap, how would you even record that with the current schema?

    – Strawberry
    Mar 9 at 12:02

















0















I know we can count rows easily, but i have some problem doing that.



this is my table



I tried to count row where the value is not equal to '-' in each month. This query below counts all row in all months.



SELECT MONTHNAME(tanggal) as bulan,
(SELECT COUNT(iad) FROM triwulan WHERE iad!='-') as iadp,
(SELECT COUNT(isk) FROM triwulan WHERE isk!='-') as isk,
(SELECT COUNT(vap) FROM triwulan WHERE vap!='-') as vap,
(SELECT COUNT(hap) FROM triwulan WHERE hap!='-') as hap,
(SELECT COUNT(plebitis) FROM triwulan WHERE plebitis!='tidak') as plebitis
FROM `triwulan`
group by bulan


I would appreciate any help, thank you..










share|improve this question



















  • 1





    This kind of problem is symptomatic of poor design. Consider having one infection_type column, with a row for each infection type.

    – Strawberry
    Mar 9 at 8:36











  • Besides, if someone recovers from isk, but still has vap, how would you even record that with the current schema?

    – Strawberry
    Mar 9 at 12:02













0












0








0








I know we can count rows easily, but i have some problem doing that.



this is my table



I tried to count row where the value is not equal to '-' in each month. This query below counts all row in all months.



SELECT MONTHNAME(tanggal) as bulan,
(SELECT COUNT(iad) FROM triwulan WHERE iad!='-') as iadp,
(SELECT COUNT(isk) FROM triwulan WHERE isk!='-') as isk,
(SELECT COUNT(vap) FROM triwulan WHERE vap!='-') as vap,
(SELECT COUNT(hap) FROM triwulan WHERE hap!='-') as hap,
(SELECT COUNT(plebitis) FROM triwulan WHERE plebitis!='tidak') as plebitis
FROM `triwulan`
group by bulan


I would appreciate any help, thank you..










share|improve this question
















I know we can count rows easily, but i have some problem doing that.



this is my table



I tried to count row where the value is not equal to '-' in each month. This query below counts all row in all months.



SELECT MONTHNAME(tanggal) as bulan,
(SELECT COUNT(iad) FROM triwulan WHERE iad!='-') as iadp,
(SELECT COUNT(isk) FROM triwulan WHERE isk!='-') as isk,
(SELECT COUNT(vap) FROM triwulan WHERE vap!='-') as vap,
(SELECT COUNT(hap) FROM triwulan WHERE hap!='-') as hap,
(SELECT COUNT(plebitis) FROM triwulan WHERE plebitis!='tidak') as plebitis
FROM `triwulan`
group by bulan


I would appreciate any help, thank you..







mysql codeigniter






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 9 at 8:06









Nick

42.2k142444




42.2k142444










asked Mar 9 at 8:01









Henry WilsonHenry Wilson

85




85







  • 1





    This kind of problem is symptomatic of poor design. Consider having one infection_type column, with a row for each infection type.

    – Strawberry
    Mar 9 at 8:36











  • Besides, if someone recovers from isk, but still has vap, how would you even record that with the current schema?

    – Strawberry
    Mar 9 at 12:02












  • 1





    This kind of problem is symptomatic of poor design. Consider having one infection_type column, with a row for each infection type.

    – Strawberry
    Mar 9 at 8:36











  • Besides, if someone recovers from isk, but still has vap, how would you even record that with the current schema?

    – Strawberry
    Mar 9 at 12:02







1




1





This kind of problem is symptomatic of poor design. Consider having one infection_type column, with a row for each infection type.

– Strawberry
Mar 9 at 8:36





This kind of problem is symptomatic of poor design. Consider having one infection_type column, with a row for each infection type.

– Strawberry
Mar 9 at 8:36













Besides, if someone recovers from isk, but still has vap, how would you even record that with the current schema?

– Strawberry
Mar 9 at 12:02





Besides, if someone recovers from isk, but still has vap, how would you even record that with the current schema?

– Strawberry
Mar 9 at 12:02












1 Answer
1






active

oldest

votes


















0














In response to comments, an example of a normalised design might look like this:



examination 
examination_id tanggal
1 2019-02-01
2 2019-02-02
3 2019-02-03
4 2019-03-01

examination_detail
examination_id infection_type plebitis
1 iad iya
1 hap iya
2 hap tidak
3 isk iya
3 vap iya
4 isk tidak
4 vap tidak


You'd have to decide whether plebitis more properly belongs in the examination table or the detail table.






share|improve this answer

























  • got it sir, thank you. I'll try to fix the table

    – Henry Wilson
    Mar 9 at 15:29











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55075247%2fcount-row-with-month-and-other-condition%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














In response to comments, an example of a normalised design might look like this:



examination 
examination_id tanggal
1 2019-02-01
2 2019-02-02
3 2019-02-03
4 2019-03-01

examination_detail
examination_id infection_type plebitis
1 iad iya
1 hap iya
2 hap tidak
3 isk iya
3 vap iya
4 isk tidak
4 vap tidak


You'd have to decide whether plebitis more properly belongs in the examination table or the detail table.






share|improve this answer

























  • got it sir, thank you. I'll try to fix the table

    – Henry Wilson
    Mar 9 at 15:29















0














In response to comments, an example of a normalised design might look like this:



examination 
examination_id tanggal
1 2019-02-01
2 2019-02-02
3 2019-02-03
4 2019-03-01

examination_detail
examination_id infection_type plebitis
1 iad iya
1 hap iya
2 hap tidak
3 isk iya
3 vap iya
4 isk tidak
4 vap tidak


You'd have to decide whether plebitis more properly belongs in the examination table or the detail table.






share|improve this answer

























  • got it sir, thank you. I'll try to fix the table

    – Henry Wilson
    Mar 9 at 15:29













0












0








0







In response to comments, an example of a normalised design might look like this:



examination 
examination_id tanggal
1 2019-02-01
2 2019-02-02
3 2019-02-03
4 2019-03-01

examination_detail
examination_id infection_type plebitis
1 iad iya
1 hap iya
2 hap tidak
3 isk iya
3 vap iya
4 isk tidak
4 vap tidak


You'd have to decide whether plebitis more properly belongs in the examination table or the detail table.






share|improve this answer















In response to comments, an example of a normalised design might look like this:



examination 
examination_id tanggal
1 2019-02-01
2 2019-02-02
3 2019-02-03
4 2019-03-01

examination_detail
examination_id infection_type plebitis
1 iad iya
1 hap iya
2 hap tidak
3 isk iya
3 vap iya
4 isk tidak
4 vap tidak


You'd have to decide whether plebitis more properly belongs in the examination table or the detail table.







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 9 at 15:42

























answered Mar 9 at 14:10









StrawberryStrawberry

26.8k83250




26.8k83250












  • got it sir, thank you. I'll try to fix the table

    – Henry Wilson
    Mar 9 at 15:29

















  • got it sir, thank you. I'll try to fix the table

    – Henry Wilson
    Mar 9 at 15:29
















got it sir, thank you. I'll try to fix the table

– Henry Wilson
Mar 9 at 15:29





got it sir, thank you. I'll try to fix the table

– Henry Wilson
Mar 9 at 15:29



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55075247%2fcount-row-with-month-and-other-condition%23new-answer', 'question_page');

);

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







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved