0

私はこれに午前中を費やしましたが、完全に困惑しています。

列の 1 つが次のように設定されている mysql テーブルがあります。

arrOpt['']={price:564.3,msrp:'779', d:'Width: 25"" |Height: 54"" |Weight: 33lbs',sku:6886939,ac:'260.00',ship:'221.95',cShip:'0.00',img:'503-13-35.jpg',imgT:'',oImg:'',shipW:'0',leadL:'7',leadU:'10',partNo:'503-13-35',invChk:'33rd',mfrStk:'',stkShip:'1',bo:'',desc:'',osum:'',upc:'702404269082',packQty:1,ship_via:'FreeTrk',freightUpgradeLvl1:'25.00',site:'home',clearancePrice:'0.00',shipTimeCutOff:'', shipTime:'Mar 12th - Mar 15th'} "

次のようになる可能性もあります。

arrOpt['264596']={price:30.25,msrp:'46.1519', d:'Length: 126"" |Height: 8.5""',sku:7356623,ac:'12.75',ship:'6.00',cShip:'0.00',img:'151_celery.jpg',imgT:'',oImg:'',shipW:'3',leadL:'7',leadU:'14',partNo:'151 Blue',invChk:'31st',mfrStk:'20',stkShip:'1',bo:'',desc:'',osum:'Blue',upc:'',packQty:1,ship_via:'Ground',freightUpgradeLvl1:'0.00',site:'baby',clearancePrice:'0.00',shipTimeCutOff:'', shipTime:'Mar 12th - Mar 19th'};arrOpt['264583']={price:30.25,msrp:'46.1519', d:'Length: 126"" |Height: 8.5""',sku:7356624,ac:'12.75',ship:'6.00',cShip:'0.00',img:'151_celery.jpg',imgT:'',oImg:'',shipW:'4',leadL:'7',leadU:'14',partNo:'151 Celery',invChk:'31st',mfrStk:'20',stkShip:'1',bo:'',desc:'',osum:'Celery',upc:'',packQty:1,ship_via:'Ground',freightUpgradeLvl1:'0.00',site:'baby',clearancePrice:'0.00',shipTimeCutOff:'', shipTime:'Mar 12th - Mar 19th'};arrOpt['264590']={price:30.25,msrp:'46.1519', d:'Length: 126"" |Height: 8.5""',sku:7356625,ac:'12.75',ship:'6.00',cShip:'0.00',img:'151_celery.jpg',imgT:'',oImg:'',shipW:'4',leadL:'7',leadU:'14',partNo:'151 Chambray',invChk:'31st',mfrStk:'7',stkShip:'1',bo:'',desc:'',osum:'Chambray',upc:'',packQty:1,ship_via:'Ground',freightUpgradeLvl1:'0.00',site:'baby',clearancePrice:'0.00',shipTimeCutOff:'', shipTime:'Mar 12th - Mar 19th'};arrOpt['264597']={price:30.25,msrp:'46.1519', d:'Length: 126"" |Height: 8.5""',sku:7356626,ac:'12.75',ship:'6.00',cShip:'0.00',img:'151_celery.jpg',imgT:'',oImg:'',shipW:'4',leadL:'7',leadU:'14',partNo:'151 Ecru',invChk:'31st',mfrStk:'30',stkShip:'1',bo:'',desc:'',osum:'Ecru',upc:'',packQty:1,ship_via:'Ground',freightUpgradeLvl1:'0.00',site:'baby',clearancePrice:'0.00',shipTimeCutOff:'', shipTime:'Mar 12th - Mar 19th'};arrOpt['264601']={price:30.25,msrp:'46.1519', d:'Length: 126"" |Height: 8.5""',sku:7356627,ac:'12.75',ship:'6.00',cShip:'0.00',img:'151_celery.jpg',imgT:'',oImg:'',shipW:'4',leadL:'7',leadU:'14',partNo:'151 Lavender',invChk:'31st',mfrStk:'25',stkShip:'1',bo:'',desc:'',osum:'Lavender',upc:'',packQty:1,ship_via:'Ground',freightUpgradeLvl1:'0.00',site:'baby',clearancePrice:'0.00',shipTimeCutOff:'', shipTime:'Mar 12th - Mar 19th'};arrOpt['264603']={price:30.25,msrp:'46.1519', d:'Length: 126"" |Height: 8.5""',sku:7356628,ac:'12.75',ship:'6.00',cShip:'0.00',img:'151_celery.jpg',imgT:'',oImg:'',shipW:'4',leadL:'7',leadU:'14',partNo:'151 Maize',invChk:'31st',mfrStk:'20',stkShip:'1',bo:'',desc:'',osum:'Maize',upc:'',packQty:1,ship_via:'Ground',freightUpgradeLvl1:'0.00',site:'baby',clearancePrice:'0.00',shipTimeCutOff:'', shipTime:'Mar 12th - Mar 19th'};arrOpt['264608']={price:30.25,msrp:'46.1519', d:'Length: 126"" |Height: 8.5""',sku:7356629,ac:'12.75',ship:'6.00',cShip:'0.00',img:'151_celery.jpg',imgT:'',oImg:'',shipW:'4',leadL:'7',leadU:'14',partNo:'151 Pink',invChk:'31st',mfrStk:'20',stkShip:'1',bo:'',desc:'',osum:'Pink',upc:'',packQty:1,ship_via:'Ground',freightUpgradeLvl1:'0.00',site:'baby',clearancePrice:'0.00',shipTimeCutOff:'', shipTime:'Mar 12th - Mar 19th'};arrOpt['264616']={price:30.25,msrp:'46.1519', d:'Length: 126"" |Height: 8.5""',sku:7356630,ac:'12.75',ship:'6.00',cShip:'0.00',img:'151_celery.jpg',imgT:'',oImg:'',shipW:'4',leadL:'7',leadU:'14',partNo:'151 White',invChk:'31st',mfrStk:'50',stkShip:'1',bo:'',desc:'',osum:'White',upc:'',packQty:1,ship_via:'Ground',freightUpgradeLvl1:'0.00',site:'baby',clearancePrice:'0.00',shipTimeCutOff:'', shipTime:'Mar 12th - Mar 19th'} 

ご覧のとおり、arrOpt が空白であるか、内部に数値を持つ複数の arrOpt を含むことができるフィールドがあります。

角かっこ内の数値を取得するには、SQL ステートメントをどのように構成すればよいでしょうか。たとえば、2番目の例から「264596、264583、264590」などを取得できるようにしたいです。

4

1 に答える 1

0

これをコーディングする時間はありませんが、次のリンクをガイドとして使用して関数を作成したいと考えています。

擬似コード:

Pos = 0;
OutString = "";
Length = Len(InString);
WHILE LocationOf "arrOpt['" in right(InString,Length - Pos) > 0
    Start = Location + 8;
    End = Locationof "'" in right(InString,Length - Start + 1);
    OutString = concatenate(OutString,",",Mid(InString,Start,End);
    Pos = End + 1;
EndWhile
OutString = right(OutString,Len(OutString) - 1;
return OutString;
于 2012-04-11T06:33:18.567 に答える