79345233

Date: 2025-01-10 09:46:40
Score: 0.5
Natty:
Report link

Try to get sum as type Long.

fun sumCarbs() : LiveData<Long>

And add case sensitive search for WHERE clause

@Query ("SELECT SUM(amountFood) FROM user_table WHERE typeFood GLOB '*' || :food || '*'")
fun sumCarbs(food : String) : LiveData<Long>

Make sure you are querying from right table.

Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Low reputation (0.5):
Posted by: Fahad Bin Asif