Skip to content
Advertisement

How to fill the custom columns with joined values

I have a query like:

I have 2 tables:

sales_order_grid (where the main data is)

sales_order_status_history (where I want to attach the status data)

I need to fetch custom columns values of the latest statuses (I mean there could be more than one status for the order, but the date differs).

Could you please help me with that?

Advertisement

Answer

I assume you want an aggregation query:

This may fix the problems you are having.

EDIT:

You are asking for the latest statuses. Then the logic is:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement