I have 3 columns :: Meeting ID - Expense Type ID - Number All these columns they have a data like below
Meeting ID - Expense Type ID - Number
2000 5 1
2000 7 2
2001 5 3
2001 5 4
2002 9 5
2002 21 5
2002 23 5
2003 9 6
2004 21 7
2005 2 8
2005 2 8
The above just an example of what I have and what the result that I need ::
- If the meeting ID is same and the expense is not in (2,9,21,22,23) then put in the last column a unique number like 1 , 2 , 3 etc … for each row
- If the meeting ID is same for and the expense is = 2 then put the same number in the last column like the above example (2005)
- If the meeting ID is same and the expense is = 9 or 21 or 22 or 23 then put the same number in the last column as the above example … (2002)
- If the meeting ID is not same then it must have a unique number as the example above … (2003 , 2004)
I couldn’t solve that using MySQL only … Is there a way in Holistics can help me? Or if anyone please can help me if we have a MySQL query for this?