select 

SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"label";s:', -4), ';', 1)
, '"', -2)
, '"', 1) products_options,

SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"value";s:', -4), ';', 1)
, '"', -2)
, '"', 1) products_options_values




from 
sales_flat_order_item sfoi join

sales_flat_order sfo on (sfoi.order_id = sfo.entity_id)



where 


sfo.entity_id  = <@ORDERS_ID@> and
sfoi.quote_item_id = <@ORDERS_PRODUCTS_ID@> and 
SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"label";s:', -4), ';', 1)
, '"', -2)
, '"', 1) <> 'info_buyRequest'

union
select 

SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"label";s:', -3), ';', 1)
, '"', -2)
, '"', 1) products_options,

SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"value";s:', -3), ';', 1)
, '"', -2)
, '"', 1) products_options_values





from 
sales_flat_order_item sfoi join

sales_flat_order sfo on (sfoi.order_id = sfo.entity_id)



where 


sfo.entity_id  = <@ORDERS_ID@> and
sfoi.quote_item_id = <@ORDERS_PRODUCTS_ID@> and 
SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"label";s:', -3), ';', 1)
, '"', -2)
, '"', 1) <> 'info_buyRequest'

union
select 

SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"label";s:', -2), ';', 1)
, '"', -2)
, '"', 1) products_options,

SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"value";s:', -2), ';', 1)
, '"', -2)
, '"', 1) products_options_values





from 
sales_flat_order_item sfoi join

sales_flat_order sfo on (sfoi.order_id = sfo.entity_id)



where 


sfo.entity_id  = <@ORDERS_ID@> and
sfoi.quote_item_id = <@ORDERS_PRODUCTS_ID@> and 
SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"label";s:', -2), ';', 1)
, '"', -2)
, '"', 1) <> 'info_buyRequest'

union
select 

SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"label";s:', -1), ';', 1)
, '"', -2)
, '"', 1) products_options,

SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"value";s:', -1), ';', 1)
, '"', -2)
, '"', 1) products_options_values





from 
sales_flat_order_item sfoi join

sales_flat_order sfo on (sfoi.order_id = sfo.entity_id)



where 


sfo.entity_id  = <@ORDERS_ID@> and
sfoi.quote_item_id = <@ORDERS_PRODUCTS_ID@> and 
SUBSTRING_INDEX(
	
SUBSTRING_INDEX(
		
SUBSTRING_INDEX(
			
SUBSTRING_INDEX(sfoi.product_options, '"label";s:', -1), ';', 1)
, '"', -2)
, '"', 1) <> 'info_buyRequest'