{
	"name": "query/manager/order/order_row/sales/test.json",
	"table": [{
		"record_type": ["sales"],
		"table": "order_row"
	}],
	"parameter": {
		"subquery": "SELECT SUBSTRING(link2, 4) FROM _link WHERE (link1 = (SELECT 'pr_' || record_id FROM product WHERE product_id = 'MA RUNKO') OR link1 = (SELECT 'w_' || record_id FROM work WHERE product_id = 'MA RUNKO')) AND link2 LIKE 'af_%'"
	},
	"field": ["ordr.order_id", "ordr.product_id"],
	"query": ["query/manager/order/order_row/sales/open.json", "and", "product_set", "and", ["ord.company_id", "=", "KONEEN VALO"]],
	"set": {
		"product_set": [
			["ordr.product_id", "=", "MA RUNKO"], "or", ["ordr.product_id", "=", "MA RUNKO V3"]
		]
	},
	"subquery": {
		"from": "order_row",
		"join_table": "production_order",
		"join_type": "LEFT OUTER JOIN",
		"join_where": [
			["pro.production_lot", "=", "ordr.production_lot"]
		],
		"query": [
			["ordr.json_data.order_type", "=", "AH"], "and", ["ordr.delivery_state", "in", ["OT", "LT"]], "and", ["pro.production_order_state", "in", ["EK", "KU", "AL", "PY"]]
		],
		"select": "SELECT SUBSTRING(link2, 4) FROM _link WHERE (link1 = (SELECT 'pr_' || record_id FROM product WHERE product_id = 'MA RUNKO') OR link1 = (SELECT 'w_' || record_id FROM work WHERE product_id = 'MA RUNKO')) AND link2 LIKE 'af_%'",
		"selectX": ["ordr.production_lot", "ordr.json_data.order_type", "ordr.delivery_state", "ordr.price_without_vat", "pro.production_order_state"]
	}
}