This may have been answered but, I've read through all the 'similar titles' and have not found an answer that better describes what I'm trying to achieve.
Mysql query is:
SELECT
inv.SKU,
inv.misc1,
inv.sizeletter,
inv.has_children,
ins_imb_1.ItemCustomerPriceLevel,
ins_imb_1.ItemNumber,
ins_imb_1.DiscountMarkupPriceRate1
FROM inv
INNER JOIN
ins_imb_1 ON ins_imb_1.ItemNumber
LIKE CONCAT( inv.SKU, '%' )
AND ins_imb_1.ItemCustomerPriceLevel = 'M'
WHERE inv.parent_sku = ''
AND inv.store_quantity > 0
AND inv.SKU LIKE 'ABC%'
AND inv.visible = 'Y'
GROUP BY inv.SKU
ORDER BY inv.SKU ASC
and the results it returns are:
SKU sizeword sizeletter has_children ItemCustomerPriceLevel ItemNumber DiscountMarkupPriceRate1
ABC107 NULL L Y M ABC107L 15.95
ABC108 NULL L Y M ABC108S 15.95
ABC109 NULL L Y M ABC109XX 17.45
sizeletter is showing up as L(large) for all items yet ItemNumber has different sizes (represented by the last letter) and therefore sometimes a different price (as our larger sizes get a markup.)
What can I do to make sure my inner join goes in order of what's available? (which are alphabetical so typically L, M, S , X etc)
So ItemNumber will always end in L unless there is none in which case it tries M etc.
Thanks in advance!