{
	"name":"query/sor/test.json",

	"subquery": {
		  "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": ["por_production_lot", "por_type_", "por_delivery_state", "por_purchase_price_total", "wo_state"],
		  "from": "purchase_order_row",
		  "join_type": "LEFT OUTER JOIN",
		  "join_table": "work_order",
		  "join_where": [
		    ["wo_production_lot", "=", "por_production_lot"]
		  ],
		  "query": [["por_type_", "=", "AH"], "and", ["por_delivery_state", "in", ["OT","LT"]], "and",["wo_state", "in", ["EK", "KU", "AL", "PY"]]]
	},

	"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_%'"
	},
	"query": [
		"sor/open.json",
		"and",
		"product_set",
		"and",
		["so_company_id", "=", "KONEEN VALO"]
	],
	"set":{
		"product_set":[
			["sor_product_id", "=", "MA RUNKO"],
			"or",
			["sor_product_id", "=", "MA RUNKO V3"]
		]
	},
	"field": [
		"sor_sales_order_id",
		"sor_product_id"
  ]
}
