Forums

read data group by conditions

peppelaria 18 May, 2018
Hi Bob.

There is some way in chronoforms 6 to set read_data group by days?

eg in mysql: GROUP BY
DAY(Access.created)

thanks in advance for your help.
GreyHead 18 May, 2018
Hi peppelaria ,

Does the Group Fields box in the Read Data action do what you need?

Bob
peppelaria 18 May, 2018
no, it doesn’t.

the string “DAY(Access.created)“ is treated like a table field and the query returns an error because that field doesn’t exists
peppelaria 23 May, 2018
Hi Bob. coffee coming soon. Have a nice day
peppelaria 01 Oct, 2018
Anyone have a working solution for this?
healyhatman 01 Oct, 2018
Put
DAY(Access.created):model.name
in the "Fields to retrieve", and "model.name" in the group by
peppelaria 01 Oct, 2018
thanks helyhatman, it works like a charm,
but wath if i need to get something lyke this: "SELECT DATE_FORMAT(`Sale.created`, "%Y-%m-%d") AS `Sale.created`"?
healyhatman 02 Oct, 2018
Answer
EDIT: everything needs to have a space separating it

DATE_FORMAT(Sale.created , "%Y-%m-%d"):Sale.created
peppelaria 02 Oct, 2018
great. it works.
thank you very mutch
This topic is locked and no more replies can be posted.

VPS & Email Hosting 20% discount
hostinger