itzumar
Posts: 88
|
Posted: 03/03/2014, 11:47 AM |
|
Dear!
I have data base of employee. I want that if sum of value exceed greater than 60 , than it should be converted into 60.
I am using mysql and php? how can u do it? plz help me
_________________
Umar |
|
|
eratech
Posts: 513
|
Posted: 03/03/2014, 3:33 PM |
|
Umar - please see my previous answer about the SQL CASE statement - it is really an IF..THEN statement in SQL.
You can then check if the sum is > 60 and return 60 instead.
Or in the 'Before Show' event for whatever you are showing the data, do the check there.
E
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
itzumar
Posts: 88
|
Posted: 03/04/2014, 12:19 AM |
|
Dear ratech!
can u explain with example???????????? will be very thankful to you
_________________
Umar |
|
|
eratech
Posts: 513
|
Posted: 03/04/2014, 4:51 PM |
|
Umar - you will learn more by trying out the CASE example.
You can put something like (case when (sum(hours) > 60) then 60 else sum(hours) end) as totallimit into your SQL and trying it out.
I suggest you look into some of the things that SQL can do as it is really powerful and often overlooked when programming in 'higher' languages.
Eric
_________________
CCS 3/4/5 ASP Classic, VB.NET, PHP
Melbourne, Victoria, Australia |
|
|
|