I need to do a custom query against the database to do the following:
With a product name I store a custom code.
This code could look like this âAE347â.
When I create a new product I give it e.g. this name:
Some product name (AE347)
For this product I have created a custom option called âDomain nameâ
Now lets say some customers have placed orders and downloaded the product.
Then I want to be able to run a custom query against the database to:
Find order âcreated dateâ and status (Payed, Pending, etc) related to product which have the code âAE347â in product name and where custom option âDomain nameâ value related to product/order contains a specific domain e.g. âwww.somedomain.comâ
I want all matching orders created_date and status that match criteria.
Example: (do not know if the logic below is correct but here we go)
Before running the query I know two things:
The custom product code stored with the product title (here âAE347")
The domain name that is stored in related custom option (in this example: e.g.: âwww.somedomain.comâ
1. Start by finding matching records in the table that stores the value for the custom option âDomain nameâ.
2. Then find related products where the custom code âAE347â is in product name.
3. Then find related orders for the above tables.
OR maybe find:
1. Find related products where the custom code âAE347â is in product name.
2. Find related records in the table that stores the value for the custom option âDomain nameâ.
3. Find related orders for the above tables.
I have tried by looking at the table structure, to figure out how such a query could look like, but have obviously not managed to find out how to do it?
Could someone please tell me how that query would look like?