I need to create a query that will produce a string from my orders_products like the below example.

Ordered products: format is "q1#sku1|q2#sku2|..." where q1 is the quantity for the product with the sku1. Use | to separate any number of products.
Example:"1#itema|2#itemb|1#itemc|5#itemd"

I am fairly new at this and can figure out how to get 1 record but an order can have multiple products. Inserting the divider is also driving me crazy because it only goes between and not before or after..


Any help is appreciated
Steve