Selecting from the range of serial numbers

Selecting from the range of serial numbers

am 24.07.2009 19:27:07 von hezjing

--0016e646055ade1d97046f76e97f
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

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

--0016e646055ade1d97046f76e97f--

RE: Selecting from the range of serial numbers

am 24.07.2009 19:45:26 von Gavin Towey

V0hFUkUgNzAgQkVUV0VFTiBzdGFydF9zZXF1ZW5jZSBBTkQgZW5kX3NlcXVl bmNlDQogQU5EICdD
JyBCRVRXRUVOIHN0YXJ0X2JhdGNoIEFORCBlbmRfYmF0Y2g7DQoNClRob3Vn aCB3aGF0IHlvdSBz
aG91bGQgcmVhbGx5IGRvIGlzIGFkZCBhIHVuaXF1ZSBhdXRvIGluY3JlbWVu dCB0byBldmVyeSBz
eW1ib2wsIHRoZW4geW91IG9ubHkgaGF2ZSB0byBkbyBhIHNpbXBsZSByYW5n ZSBjaGVjay4NCg0K
T3IgdXNlIGEgZnVsbCByZWxhdGlvbmFsIHN0cnVjdHVyZSBhbmQgaGF2ZSBh IE9UTSBvciBNVE0g
d2l0aCB5b3VyIHN0b2NrIHRhYmxlLg0KDQpSZWdhcmRzLA0KR2F2aW4gVG93 ZXkNCg0KLS0tLS1P
cmlnaW5hbCBNZXNzYWdlLS0tLS0NCkZyb206IGhlemppbmcgW21haWx0bzpo ZXpqaW5nQGdtYWls
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