2015-01-20 71 views
0

數據我有一種稀有的,以顯示數據,同時考慮到以下各表如下:混亂,以顯示與「馬」和「馬」

mysql> describe materiales; 
+-----------+--------------+------+-----+------------+----------------+ 
| Field  | Type   | Null | Key | Default | Extra   | 
+-----------+--------------+------+-----+------------+----------------+ 
| registro | int(12)  | NO | PRI | NULL  | auto_increment | 
| clave  | char(6)  | NO | UNI |   |    | 
| clave2 | char(20)  | YES | MUL |   |    | 
| descr  | char(30)  | YES |  |   |    | 
| descr2 | char(250) | YES |  |   |    | 
| unidad | char(7)  | YES |  |   |    | 
| presest | double(18,7) | YES |  | 0.0000000 |    | 
| unidadpre | char(7)  | YES |  |   |    | 
| codbar | char(30)  | YES |  |   |    | 
| impuesto | double(18,7) | YES |  | 0.0000000 |    | 
| mantpend | tinyint(1) | YES |  | 0   |    | 
| grupplat | char(6)  | YES | MUL |   |    | 
| fechalta | date   | YES |  | 0000-00-00 |    | 
| usuarmod | char(6)  | YES |  |   |    | 
| fechamod | date   | YES |  | 0000-00-00 |    | 
+-----------+--------------+------+-----+------------+----------------+ 

mysql> describe grupos; 
+----------+----------+------+-----+------------+----------------+ 
| Field | Type  | Null | Key | Default | Extra   | 
+----------+----------+------+-----+------------+----------------+ 
| registro | int(12) | NO | PRI | NULL  | auto_increment | 
| clave | char(6) | NO | UNI |   |    | 
| descr | char(30) | YES |  |   |    | 
| fechalta | date  | YES |  | 0000-00-00 |    | 
| usuarmod | char(6) | YES |  |   |    | 
| fechamod | date  | YES |  | 0000-00-00 |    | 
+----------+----------+------+-----+------------+----------------+ 

要查詢,我只想告訴我的馬只有grupplat但顯示我的馬和馬的見底:

mysql> SELECT CLAVE,DESCR,GRUPPLAT FROM MATERIALES WHERE 
grupplat>='MA' AND grupplat<='MA' ORDER BY GRUPPLAT; 
+--------+--------------------------------+----------+ 
| CLAVE | DESCR       | GRUPPLAT | 
+--------+--------------------------------+----------+ 
| PE100A | DEDOS QUESO     | MA  | 
| PE125A | FUNKY MONKEY BITES    | MA  | 
| PE125B | LUCKY DOG BOGARTS D-LIGHT  | MA  | 
| PE125C | ROCKY ROAD PEANUT BUTTER BITES | MA  | 
| PE125D | SIRENAS SEAFOOD MEDLEY   | MA  | 
| PE200A | HOJA TRANSFER     | MA  | 
| PE250A | FRITURA CHURIS     | MA  | 
| PE271A | HAMBURGUESA AMERICANA RES  | MA  | 
| PE271B | HAMBURGUESA AMERICANA JR  | MA  | 
| PE275A | PAPA ADOBADA     | MA  | 
| PE301A | PAPA FRANCESA 1-4    | MA  | 
| PE304A | PAPA FRANCESA 3-8    | MA  | 
| PE308A | PAPA FRANCESA 5-16    | MA  | 
| PE312A | PAPA FRITA      | MA  | 
| PE315A | PAPA GAJO NATURAL    | MA  | 
| PE335A | PAPA HASH TRIANGULO   | MA  | 
| PE370A | POLLO ALITA MARINADA IQF  | MA  | 
| PE385A | POLLO NUGGET     | MA  | 
| PE410A | PIZZA BASE      | MA  | 
| PE411A | PIZZA REDONDA DULCE   | MA  | 
| PE413A | PIZZA DE ZATAR     | MA  | 
| PE450A | VERDURA CONGELADA MIXTA  | MA  | 
| PE510A | WAFLES       | MA  | 
| PF0001 | PRODUCTO FICTICIO    | Ma  | <--- ERROR 
| PF0002 | AGUA POTABLE     | Ma  | <--- ERROR 
| PF0003 | AGUA DE GARRAFON    | Ma  | <--- ERROR 
| PF0004 | HIELO       | Ma  | <--- ERROR 
| PE250F | FRITURA CAZARES    | MA  | 
| PE301H | PAPA FRANCESA 1-2 ONDULADA  | MA  | 
| PE510D | WAFFLES      | MA  | 
| PE271C | HAMBURGUESA ARRACHERA 198 G | MA  | 
| PE370B | POLLO ALITAS MARINADAS   | MA  | 
+--------+--------------------------------+----------+ 

,你可以看到,但放在另一個查詢與以下類似下面的語法,只顯示「馬」的數據,但。 ..向我展示'Ma'和'MA'的所有數據

mysql> SELECT CLAVE,DESCR,GRUPPLAT FROM MATERIALES WHERE 
grupplat>='Ma' AND grupplat<='Ma' ORDER BY GRUPPLAT; 
+--------+--------------------------------+----------+ 
| CLAVE | DESCR       | GRUPPLAT | 
+--------+--------------------------------+----------+ 
| PE100A | DEDOS QUESO     | MA  | 
| PE125A | FUNKY MONKEY BITES    | MA  | 
| PE125B | LUCKY DOG BOGARTS D-LIGHT  | MA  | 
| PE125C | ROCKY ROAD PEANUT BUTTER BITES | MA  | 
| PE125D | SIRENAS SEAFOOD MEDLEY   | MA  | 
| PE200A | HOJA TRANSFER     | MA  | 
| PE250A | FRITURA CHURIS     | MA  | 
| PE271A | HAMBURGUESA AMERICANA RES  | MA  | 
| PE271B | HAMBURGUESA AMERICANA JR  | MA  | 
| PE275A | PAPA ADOBADA     | MA  | 
| PE301A | PAPA FRANCESA 1-4    | MA  | 
| PE304A | PAPA FRANCESA 3-8    | MA  | 
| PE308A | PAPA FRANCESA 5-16    | MA  | 
| PE312A | PAPA FRITA      | MA  | 
| PE315A | PAPA GAJO NATURAL    | MA  | 
| PE335A | PAPA HASH TRIANGULO   | MA  | 
| PE370A | POLLO ALITA MARINADA IQF  | MA  | 
| PE385A | POLLO NUGGET     | MA  | 
| PE410A | PIZZA BASE      | MA  | 
| PE411A | PIZZA REDONDA DULCE   | MA  | 
| PE413A | PIZZA DE ZATAR     | MA  | 
| PE450A | VERDURA CONGELADA MIXTA  | MA  | 
| PE510A | WAFLES       | MA  | 
| PF0001 | PRODUCTO FICTICIO    | Ma  | 
| PF0002 | AGUA POTABLE     | Ma  | 
| PF0003 | AGUA DE GARRAFON    | Ma  | 
| PF0004 | HIELO       | Ma  | 
| PE250F | FRITURA CAZARES    | MA  | 
| PE301H | PAPA FRANCESA 1-2 ONDULADA  | MA  | 
| PE510D | WAFFLES      | MA  | 
| PE271C | HAMBURGUESA ARRACHERA 198 G | MA  | 
| PE370B | POLLO ALITAS MARINADAS   | MA  | 
+--------+--------------------------------+----------+ 

但如果訂單是「GROUP BY」,因爲某些原因不是「馬」,如果我通過查詢,發現該groupplat的個兒顯示我喜歡出現

mysql> SELECT CLAVE,DESCR,GRUPPLAT FROM MATERIALES group BY grupplat; 
+--------+--------------------------------+----------+ 
| CLAVE | DESCR       | GRUPPLAT | 
+--------+--------------------------------+----------+ 
| AB002A | ACEITE DE CACAHUATE   | M0  | 
| AV005A | HUEVO       | M1  | 
| CR005A | CERDO BISTEC     | M2  | 
| EM010A | CERDO CHORIZO     | M3  | 
| ES005A | ACHIOTE      | M4  | 
| FV003A | ACELGA       | M5  | 
| LA010A | CREMA ACIDA     | M6  | 
| PN010A | BISQUET DULCE 30 G    | M7  | 
| PA010A | CAPELLINI      | M8  | 
| PM005A | ALMEJA CHIRLA     | M9  | 
| PE100A | DEDOS QUESO     | MA  | 
| PO010A | ACEITE DE AJONJOLI PICANTE  | MB  | 
| TT050A | MASA DE MAIZ     | MC  | 
| PT010A | BROWNIE      | MD  | 
| HN010A | HELADO BANANA BLU    | ME  | 
| AR005A | AGUA NATURAL 355 ML   | MI  | 
| CA010A | CAFE CAREY GOURMET GRANO  | MJ  | 
| CO025A | GINSENG AMPOLLETA    | ML  | 
| TE005A | TE AMANECER     | MM  | 
| CE010A | BOHEMIA 355 ML     | MN  | 
| AN005A | ANIS CHINCHON DULCE   | MO  | 
| BR010A | BRANDY AZTECA DE ORO   | MP  | 
| CV070A | CH MOET CHANDON DOM PERIGNON | MQ  | 
| CG010A | COGNAC COURVOISIER V.S.O.P  | MR  | 
| CL002A | AGUARDIENTE CACHACA   | MS  | 
| GI015A | GINEBRA BEEFEATER    | MT  | 
| RO010A | RON APPLETON BLANCO   | MU  | 
| TQ010A | MEZ ALIPUS SAN ANDRES   | MV  | 
| VO020A | VODKA ABSOLUT     | MW  | 
| WH010A | WHISKY BALLANTINES FINEST  | MX  | 
| VB010A | VB ALBERT BICHOT CHABLIS  | MY  | 
| VR050A | VR CERAUSOLO TOSE D ABRUZZO LA | MZ  | 
+--------+--------------------------------+----------+ 
組的表

這樣的:

mysql> SELECT registro,clave,descr FROM compras.grupos group by clave; 
+----------+-------+----------------------+ 
| registro | clave | descr    | 
+----------+-------+----------------------+ 
|  3 | M0 | ABARROTES   | 
|  4 | M1 | AVES     | 
|  5 | M2 | CARNES ROJAS   | 
|  6 | M3 | EMBUTIDOS   | 
|  7 | M4 | ESPECIAS-SECOS  | 
|  8 | M5 | FRUTAS-VERDURAS  | 
|  9 | M6 | LACTEOS    | 
|  10 | M7 | PANES    | 
|  11 | M8 | PASTAS    | 
|  12 | M9 | PESCADOS-MARISCOS | 
|  13 | MA | PRODUCTOS ELABORADOS | 
|  14 | MB | PRODUCTOS ORIENTALES | 
|  15 | MC | TORTILLAS   | 
|  16 | MD | PASTELES    | 
|  17 | ME | HELADOS-NIEVES  | 
|  18 | MF | PRODUCTOS EXOTICOS | 
|  19 | MI | AGUAS-REFRESCOS  | 
|  20 | MJ | CAFES    | 
|  21 | MK | CHOCOLATES FRAPPES | 
|  22 | ML | COMPLEMENTOS ALIMENT | 
|  23 | MM | TES     | 
|  24 | MN | CERVEZAS    | 
|  25 | MO | ANISES    | 
|  26 | MP | BRANDYS    | 
|  27 | MQ | CHAMPAGNES-VINOS ES | 
|  28 | MR | COGNACS    | 
|  29 | MS | CREMAS-LICORES-OPORT | 
|  30 | MT | GINEBRAS    | 
|  31 | MU | RONES    | 
|  32 | MV | TEQUILAS    | 
|  33 | MW | VODKAS    | 
|  34 | MX | WHISKYS    | 
|  35 | MY | VINOS BLANCOS  | 
|  36 | MZ | VINOS TINTOS   | 
|  37 | Ma | AGREGADOS   | 
+----------+-------+----------------------+ 

所以......不,如果我不得不改變或是否刪除MATERIALES表的關鍵「MUL」看到,因爲當我做組「馬雲的查詢,如果「解決問題」 '沒有表演......但'馬'是的...所以我已經非常沮喪,我發現這個非常惱人的錯誤!因爲我用這個另一個查詢連接表,我需要向用戶展示與內餐廳加入,但我提出這個問題,因爲MYSQL,因爲它不顯示馬...得到它像MA

SELECT * FROM DETOC INNER JOIN MATERIALES ON DETOC.MATERIAL = MATERIALES.CLAVE 
        INNER JOIN GRUPOS ON MATERIALES.GRUPPLAT = GRUPOS.CLAVE 
        INNER JOIN ORDENESCOMPRA ON DETOC.ORDCOMP = ORDENESCOMPRA.CLAVE 
        INNER JOIN PROVEEDORES ON ORDENESCOMPRA.CVEPROV = PROVEEDORES.CLAVE 
        INNER JOIN AREAS ON ORDENESCOMPRA.AREA = AREAS.CLAVE 
        WHERE ORDENESCOMPRA.FECHALTA>='2014-01-01' AND ORDENESCOMPRA.FECHALTA<='2015-01-19' 
         AND ORDENESCOMPRA.AREA>=' 50' AND ORDENESCOMPRA.AREA<=' AF2' 
         AND ORDENESCOMPRA.CVEPROV>='000004' AND ORDENESCOMPRA.CVEPROV<='011551' 
         AND MATERIALES.CLAVE>='AB002A' AND MATERIALES.CLAVE<='WH420A' 
         AND MATERIALES.GRUPPLAT>='M0' AND MATERIALES.GRUPPLAT<='Ma' 
         AND ORDENESCOMPRA.CLAVE>='8780' AND ORDENESCOMPRA.CLAVE<='8790'; 
+0

更新它們是一樣的嗎? – robert 2015-01-20 18:35:20

+3

您需要將表格更改爲區分大小寫的排序規則。否則,在比較和分組中,'MA'和'Ma'被視爲等價物。 – Barmar 2015-01-20 18:36:47

+2

嘗試'WHERE grupplat COLLATE latin1_general_cs> ='MA'AND grupplat COLLATE latin1_general_cs <='MA'' – Mihai 2015-01-20 18:37:12

回答

1

在不區分大小寫的數據庫中,「MA」和「Ma」和「ma」完全相同。

如果您希望它們的處理方式不同,則應該使表或列或數據庫區分大小寫。請注意,這會影響遠遠超過您和您的特殊查詢,因此請確保業務要求,並確保爲數據庫開發的所有其他人都意識到可能發生的變化,並在推廣到產品之前充分利用QA中的數據庫。

如果您只是偶爾需要區分大小寫,則可以在查詢中使用排序規則。但請注意,這會爲您的查詢增加額外時間,並且您必須每查詢需要這種情況下才能使用。如果你需要對所有查詢進行此操作,那麼它必須完成inteh數據庫。

在sql server中,你可以將排序設置應用到單個列,但我不知道如果這可能在MySQL中。我也不知道是否有可能在底層表不是的時候創建一個區分大小寫的視圖。但這是值得嘗試的。

0

好的......我嘗試機智COLLATE latin1_general_cs但是這種解決方案不解決這個問題,因爲當我嘗試這個辦法:

select detoc.ordcomp, materiales.clave,materiales.descr, grupos.clave,grupos.descr from detoc 
       inner join materiales on detoc.material = materiales.clave 
       INNER JOIN GRUPOS ON MATERIALES.GRUPPLAT = GRUPOS.CLAVE 
       INNER JOIN ORDENESCOMPRA ON DETOC.ORDCOMP = ORDENESCOMPRA.CLAVE 
       INNER JOIN PROVEEDORES ON ORDENESCOMPRA.CVEPROV = PROVEEDORES.CLAVE 
       INNER JOIN AREAS ON ORDENESCOMPRA.AREA = AREAS.CLAVE 
       WHERE ORDENESCOMPRA.CLAVE>='8781' AND ORDENESCOMPRA.CLAVE<='8791' 
       AND MATERIALES.GRUPPLAT COLLATE latin1_general_cs>='M0' AND MATERIALES.GRUPPLAT COLLATE latin1_general_cs<='Ma'; 

數據顯示我:

+---------+--------+--------------------------------+-------+----------------------+ 
| ordcomp | clave | descr       | clave | descr    | 
+---------+--------+--------------------------------+-------+----------------------+ 
| 8782 | PN540B | PAN DULCE CROSSAINT CHABACANO | M7 | PANES    | 
| 8782 | PN451B | PAN CAMPESINO RUSTICO MINI .06 | M7 | PANES    | 
| 8782 | PN511A | PAN CHAPATA RUSTICA MINI .060 | M7 | PANES    | 
| 8782 | PN310C | PAN BAGUET CAMPESINO .060 KILO | M7 | PANES    | 
| 8782 | PN310D | PAN BAGUET 350 GR    | M7 | PANES    | 
| 8782 | PN535B | PAN DULCE CONCHA BLANCA .030 | M7 | PANES    | 
| 8782 | PN535C | PAN DULCE CONCHA CHOCOLATE .03 | M7 | PANES    | 
| 8782 | PN530B | PAN CHOCOLATIN 30 G   | M7 | PANES    | 
| 8782 | PN560B | PAN MINI DANES .030   | M7 | PANES    | 
| 8782 | PE410A | PIZZA BASE      | MA | PRODUCTOS ELABORADOS | 
| 8783 | FV007A | AGUACATE HASS EXTRA   | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV421A | JITOMATE GUAJE PARA MOLER  | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV455A | KIWI       | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV570A | MAMEY       | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV643A | NARANJA AMARILLA    | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV653B | NOPAL CAMBRAY     | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV720C | PAPA ALFA GRANDE    | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV725A | PAPA CAMBRAY     | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV746A | PEPINO       | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV755B | PIMIENTO ROJO     | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV755C | PIMIENTO VERDE     | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV763C | PLATANO TABASCO    | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV124A | CEBOLLIN      | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV415A | JITOMATE BOLA     | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV418A | JITOMATE CHERRY    | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV305A | GERMINADO DE ALFALFA   | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV107A | CALABAZA ITALIANA    | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV118B | CEBOLLA BLANCA MEDIANA   | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV122A | CEBOLLA MORADA     | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV144A | CHILE SERRANO     | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV136A | CHILE CUARESMENO GRANDE  | M5 | FRUTAS-VERDURAS  | 
| 8783 | ES090A | CHILE MORITA     | M4 | ESPECIAS-SECOS  | 
| 8783 | FV147A | CILANTRO      | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV232A | EPAZOTE      | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV235B | ESPARRAGO MEDIANO    | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV767A | PORTOBELLO JUMBO    | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV355A | HIERBABUENA     | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV277A | FRESA DRISCOL     | M5 | FRUTAS-VERDURAS  | 
| 8783 | FV127A | CHAMPINONES JUMBO    | M5 | FRUTAS-VERDURAS  | 
| 8784 | AB165D | FRIJOL NEGRO     | M0 | ABARROTES   | 
| 8785 | PN510F | PAN CHAPATA NATURAL 100 GR  | M7 | PANES    | 
| 8785 | PN420C | PAN BOLLO NATURAL 100 G  | M7 | PANES    | 
| 8786 | FV107A | CALABAZA ITALIANA    | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV418A | JITOMATE CHERRY    | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV277A | FRESA DRISCOL     | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV355A | HIERBABUENA     | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV767A | PORTOBELLO JUMBO    | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV235B | ESPARRAGO MEDIANO    | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV147A | CILANTRO      | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV124A | CEBOLLIN      | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV890A | UVA VERDE SIN SEMILLA   | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV763A | PLATANO MACHO     | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV763C | PLATANO TABASCO    | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV725A | PAPA CAMBRAY     | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV643A | NARANJA AMARILLA    | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV136A | CHILE CUARESMENO GRANDE  | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV144A | CHILE SERRANO     | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV127A | CHAMPINONES JUMBO    | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV118B | CEBOLLA BLANCA MEDIANA   | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV110A | CAMOTE AMARILLO    | M5 | FRUTAS-VERDURAS  | 
| 8786 | FV421A | JITOMATE GUAJE PARA MOLER  | M5 | FRUTAS-VERDURAS  | 
| 8787 | AV010A | POLLO PECHUGA DESHUESADA  | M1 | AVES     | 
| 8787 | AV015A | POLLO PECHUGA ENTERA   | M1 | AVES     | 
| 8787 | AV025A | POLLO PIERNA CON MUSLO   | M1 | AVES     | 
| 8787 | AV005A | HUEVO       | M1 | AVES     | 
| 8788 | LA125C | QUESO CREMA     | M6 | LACTEOS    | 
| 8788 | LA260B | YOGHURT NATURAL    | M6 | LACTEOS    | 
| 8788 | LA115C | QUESO COTTAGE     | M6 | LACTEOS    | 
| 8788 | LA080B | MANTEQUILLA     | M6 | LACTEOS    | 
| 8788 | EM100B | PAVO JAMON      | M3 | EMBUTIDOS   | 
| 8788 | LA205A | QUESO PANELA     | M6 | LACTEOS    | 
| 8790 | EM215A | VIENA SALCHICHA    | M3 | EMBUTIDOS   | 
| 8790 | LA062B | LECHE ENTERA     | M6 | LACTEOS    | 
+---------+--------+--------------------------------+-------+----------------------+ 

的問題是,沒有從8781所顯示的數據應該顯示例如,如果我試試這個:

select detoc.ordcomp, materiales.clave,materiales.descr, grupos.clave,grupos.descr from detoc 
       inner join materiales on detoc.material = materiales.clave 
       INNER JOIN GRUPOS ON MATERIALES.GRUPPLAT = GRUPOS.CLAVE 
       INNER JOIN ORDENESCOMPRA ON DETOC.ORDCOMP = ORDENESCOMPRA.CLAVE 
       INNER JOIN PROVEEDORES ON ORDENESCOMPRA.CVEPROV = PROVEEDORES.CLAVE 
       INNER JOIN AREAS ON ORDENESCOMPRA.AREA = AREAS.CLAVE 
       WHERE ORDENESCOMPRA.CLAVE>='8781' AND ORDENESCOMPRA.CLAVE<='8782' 
       AND MATERIALES.GRUPPLAT COLLATE latin1_general_cs>='M0' AND MATERIALES.GRUPPLAT COLLATE latin1_general_cs<='MZ'; 

它告訴我:

+---------+--------+--------------------------------+-------+----------------------+ 
| ordcomp | clave | descr       | clave | descr    | 
+---------+--------+--------------------------------+-------+----------------------+ 
| 8781 | CE010F | BOHEMIA OBSCURA 355 ML R  | MN | CERVEZAS    | 
| 8781 | CE010E | BOHEMIA 355 ML R    | MN | CERVEZAS    | 
| 8781 | CE080C | SOL 355 ML R     | MN | CERVEZAS    | 
| 8781 | CE085C | TECATE 325 ML R    | MN | CERVEZAS    | 
| 8781 | CE085F | TECATE LIGHT 325 ML R   | MN | CERVEZAS    | 
| 8782 | PN540B | PAN DULCE CROSSAINT CHABACANO | M7 | PANES    | 
| 8782 | PN451B | PAN CAMPESINO RUSTICO MINI .06 | M7 | PANES    | 
| 8782 | PN511A | PAN CHAPATA RUSTICA MINI .060 | M7 | PANES    | 
| 8782 | PN310C | PAN BAGUET CAMPESINO .060 KILO | M7 | PANES    | 
| 8782 | PN310D | PAN BAGUET 350 GR    | M7 | PANES    | 
| 8782 | PN535B | PAN DULCE CONCHA BLANCA .030 | M7 | PANES    | 
| 8782 | PN535C | PAN DULCE CONCHA CHOCOLATE .03 | M7 | PANES    | 
| 8782 | PN530B | PAN CHOCOLATIN 30 G   | M7 | PANES    | 
| 8782 | PN560B | PAN MINI DANES .030   | M7 | PANES    | 
| 8782 | PE410A | PIZZA BASE      | MA | PRODUCTOS ELABORADOS | 
+---------+--------+--------------------------------+-------+----------------------+ 

所以......我結束了想法......因爲數據的規模而改變,使它變得非常困難!