floor icon indicating copy to clipboard operation
floor copied to clipboard

Query with IF

Open ferut opened this issue 3 years ago • 1 comments

Hi all is it possible to do query with IF?

@DatabaseView("SELECT SUM(if (eventType = Entrata, eventAmount, eventAmount*(-1))) as eventAmounts,eventDate FROM Event GROUP BY eventDate", viewName: 'EventForChart') class EventForChart{

DateTime eventDate; double eventAmounts;

EventForChart(this.eventDate,this.eventAmounts); }

Like this one?

ferut avatar Mar 13 '23 16:03 ferut

Hi @ferut, Could it be that you are looking for IIF? https://www.sqlitetutorial.net/sqlite-functions/sqlite-iif/

SEGVeenstra avatar Jul 04 '23 12:07 SEGVeenstra