Skip to content

Instantly share code, notes, and snippets.

@Kirow
Created April 14, 2016 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kirow/044b0a1857b19853a9406b216e2c6dd9 to your computer and use it in GitHub Desktop.
Save Kirow/044b0a1857b19853a9406b216e2c6dd9 to your computer and use it in GitHub Desktop.
SELECT UPC THAT COULD BE CONVERTED TO UPC-E
/* http://www.taltech.com/barcodesoftware/symbologies/upc
UPC-A Number Equivalent UPC-E Notes
0ab00000cdeX abcde0X Manufacturer code must have 2 leading digits with 3 trailing zeros and the item number is limited to 3 digits (000 to 999).
0ab10000cdeX abcde1X Manufacturer code must have 3 leading digits ending with "1" and 2 trailing zeros. The item number is limited to 3 digits.
0ab20000cdeX abcde2X Manufacturer code must have 3 leading digits ending with "2" and 2 trailing zeros. The item number is limited to 3 digits.
0abc00000deX abcde3X Manufacturer code must have 3 leading digits and 2 trailing zeros. The item number is limited to 2 digits (00 to 99).
0abcd00000eX abcde4X Manufacturer code must have 4 leading digits with 1 trailing zero and the item number is limited to 1 digit (0 to9).
0abcde00005X abcde5X Manufacturer code has all 5 digits.
0abcde00006X abcde6X The item number is limited to a single
0abcde00007X abcde7X digit consisting of either 5,6,7,8 or 9.
0abcde00008X abcde8X
0abcde00009X abcde9X
*/
SELECT * FROM Items WHERE UPC REGEXP '0..00000....$' AND UPC != '0000000000000'
SELECT * FROM Items WHERE UPC REGEXP '0..10000....$' AND UPC != '0000000000000'
SELECT * FROM Items WHERE UPC REGEXP '0..20000....$' AND UPC != '0000000000000'
SELECT * FROM Items WHERE UPC REGEXP '0...00000...$' AND UPC != '0000000000000'
SELECT * FROM Items WHERE UPC REGEXP '0....00000..$' AND UPC != '0000000000000'
SELECT * FROM Items WHERE UPC REGEXP '0.....00005.$' AND UPC != '0000000000000'
SELECT * FROM Items WHERE UPC REGEXP '0.....00006.$' AND UPC != '0000000000000'
SELECT * FROM Items WHERE UPC REGEXP '0.....00007.$' AND UPC != '0000000000000'
SELECT * FROM Items WHERE UPC REGEXP '0.....00008.$' AND UPC != '0000000000000'
SELECT * FROM Items WHERE UPC REGEXP '0.....00009.$' AND UPC != '0000000000000'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment