[Noob] Need help on Lazarus-SQL lazarus / 16-Databases ---------------------------------------------------------------------- workinghard · 2012-04-22 03:48 Hello everyone, right now i'm trying to practice some lazarus-mysql programming, and i have some questions, can i filter the conditions For example, like from this table   |    Size    |  Deviation  |     1.|     80     |      30     | 2.|     100    |      40     | (Sorry for the crude table) I need to calculate the ones  with size 80 in this way: if the size is 80 and deviation <= 10, then result = (deviation)*1000), otherwise  if deviation <=20 then result =  (deviation-10)*2000 + 10*1000. and  if deviation >=21 then result = (deviation-20)*3000 + 10*2000 +10*1000 And if the size is 100, it will be: if the size is 100 and deviation <= 10, then result = (deviation)*2000, otherwise if deviation <=20 then result = (deviation-10)*3000 + 10*2000 and if deviation >=21 then result = (deviation-20)*4000 + 10*3000 +10*2000 How can i make lazarus to be able to do this? I can do this on freepascal and without the datas from sql but on this, i'm very confused I am really confused right now I'm using win7 x64 and lazarus 0.9.30 and FPC 2.6.0 Thanks in advance Regards, workinghard ---------------------------------------------------------------------- Leledumbo · 2012-04-22 04:46 Just change the select query condition accordingly, use the case expression.