I have a sql query in which in concatenating 2 fields.
Is there any way to get only values which are numbers after doing concat ??
SELECT devbg_products.*, devbg_categories.*, devbg_subcategories.*, lockmfgs.* FROM devbg_products
LEFT JOIN devbg_categories ON devbg_products.ItemCategory = devbg_categories.CategoryID
LEFT JOIN devbg_subcategories ON devbg_products.ItemSubcategory = devbg_subcategories.SubcategoryID
LEFT JOIN lockmfgs ON devbg_products.ItemLockID = lockmfgs.LockID WHERE
85111 >= CONCAT(devbg_products.RngPrefix, devbg_products.StrRange) AND
85111 <= CONCAT(devbg_products.RngPrefix, devbg_products.EndRange) AND
devbg_categories.Status = '0' ORDER BY devbg_products.ItemName
Its comparing 85111 value with concatenated values 3E001 and 3E350 respectively which is wrong.
If after concatenating the value is not numeric then it should be ignored.
Thats what I am trying to achieve but don't know how to do. Please help.
I did cast(CONCAT(devbg_products.RngPrefix, devbg_products.StrRange) AS UNSIGNED) and its working.
This topic is now closed. New replies are no longer allowed.