Functionality for min(column) max(colum) and 'GROUP BY column'
Hi Maurits, how are you?
I am converting an application form accessing a mysql database directly to using a REST API.
One sql string is puzzling me a bit:
sql = string.Format("SELECT adres, kwhmeter_id, min(pulsen), max(pulsen) FROM 'pulsen' WHERE (gebruiker_id=@gebruiker_id) AND (timestamp>='{0}') AND (timestamp<='{1}') GROUP BY adres", StartDate.ToString(MYSQL_DATE_FORMAT), EndDate.ToString(MYSQL_DATE_FORMAT));
Could not find it in the docs, so I am wondering... Is the following functionality present in your api.php?
-
min(column) -
max(colum) -
GROUP BY column
If not do you have suggestions in how to implement it?
Thanks on forehand!
Looking forward to hearing from you, Best regards, Raymond
I usually use MYSQL views for complex queries. That way, it's the db engine that processes it and it just returns a tabular result that can be "exposed" via php-crud-api endpoint
Hi Maurits, how are you?
Hi Raymond, I'm doing fine thank you.
Is the following functionality present in your api.php?
No, it is not.
If not do you have suggestions in how to implement it?
I agree with @apps-caraga that the use of a database view would be a good solution for such reporting needs.
Kind regards,
Maurits