Mysql - Counting number of occurrences of value in multiple columns
Closed
BrianGreen
Posts
1005
Registration date
Saturday January 17, 2015
Status
Moderator
Last seen
September 30, 2021
-
Feb 26, 2019 at 05:20 PM
dragontattoo Posts 2 Registration date Tuesday July 16, 2019 Status Member Last seen October 4, 2019 - Oct 4, 2019 at 11:01 AM
dragontattoo Posts 2 Registration date Tuesday July 16, 2019 Status Member Last seen October 4, 2019 - Oct 4, 2019 at 11:01 AM
Related:
- Mysql count number of occurrences in a column
- Count if cell contains number - Excel Forum
- Excel count occurrences of string in column - Guide
- How to count names in excel - Guide
- How do i auto number a column in excel? ✓ - Excel Forum
- Count sentences ✓ - Programming Forum
2 responses
Well, looking at the ingredients table, no combination matches your WANTED output.
SWEET.......SAVORY.....eatdate
3__________1_________2019-2-3
2__________4_________2019-2-4
1__________1_________2019-2-5
1__________4_________2019-2-6
2__________1_________2019-2-7
If, we add up any combination, we can never get to the total of:
"Alan Jones ate 2 sweet and 3 savory"
As, there is no value of 3 for savory, so that means that we have to look at the sweet, and there is no mathematical way to get to a combination of 2 and 3. We need the person ID to verify the data!
SWEET.......SAVORY.....eatdate
3__________1_________2019-2-3
2__________4_________2019-2-4
1__________1_________2019-2-5
1__________4_________2019-2-6
2__________1_________2019-2-7
If, we add up any combination, we can never get to the total of:
"Alan Jones ate 2 sweet and 3 savory"
As, there is no value of 3 for savory, so that means that we have to look at the sweet, and there is no mathematical way to get to a combination of 2 and 3. We need the person ID to verify the data!
Feb 27, 2019 at 05:31 AM
Thanks for your speedy reply. But I think you are going to get a cold supper :^)
Alan Jones has an ID of 1 (in the "people" table). There are two 1s in the SWEET column, and three 1s in the SAVORY column in the ingredients column. Hence the "Alan Jones ate 2 sweet and 3 savory" in the wish list.
Feb 27, 2019 at 07:21 AM