WHERE 70 BETWEEN start_sequence AND end_sequence AND 'C' BETWEEN start_batch AND end_batch;
Though what you should really do is add a unique auto increment to every symbol, then you only have to do a simple range check. Or use a full relational structure and have a OTM or MTM with your stock table. Regards, Gavin Towey -----Original Message----- From: hezjing [mailto:[email protected]] Sent: Friday, July 24, 2009 10:27 AM To: [email protected] Subject: Selecting from the range of serial numbers Hi My stock serial number format is 00001A - 99999A, 00001B - 99999B ... 00001Z - 99999Z. These stocks are check in to warehouse in different order, so the worker may check in the stocks like 00001A - 00100A 99999B - 00010C 00051B - 00070B I have a table to keep track the stock check in transaction: STOCK_CHECKIN start_sequence int(10) unsigned start_batch char(1) end_sequence int(10) unsigned end_batch char(1) and the data for the above example will look like this: start_sequence start_batch end_sequence end_batch 00001 A 00100 A 99999 B 00010 C 00051 B 00070 B I couldn't figure out how to determine if a specific serial number is already checked in into the warehouse. Based on the above data, the serial number 00010A, 00001C and 00070B are already checked in. How would be the effective SQL looks like? Thank you! -- Hez The information contained in this transmission may contain privileged and confidential information. It is intended only for the use of the person(s) named above. If you are not the intended recipient, you are hereby notified that any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
