douhuan3448 2016-11-28 09:30
浏览 315

如何从mysql中的json中提取数据

m trying to extract data from json in mysql: my sample mysql query is : I already tried using below code , but its returning null vales , But i have value in database . In the below code column_name1 and er_trading_sales is column name and table_name is the name of the table

    SELECT column_name1 as column_name1,
        substring(
        er_trading_sales,
        locate('"C2":{"type":"label","value":"":{"m":"label","k":"(a) to registered       dealers","v":"}","C3": {    "type":"textbox","value":"',er_trading_sales,locate('"Trading_B_I"',er_trading_s ales))+70,
    (locate('"},"C4',er_trading_sales,locate('"C2":{"type":"label","value":"":{"m":"label","k":"(a) to registered dealers","v":"}","C3":{"type":"textbox","value":"',er_trading_sales,locate('"Trading_B_I"',er_trading_sales))) - (locate('"C2":{"type":"label","value":"":{"m":"label","k":"(a) to registered dealers","v":"}","C3":       {"type":"textbox","value":"',er_trading_sales,locate('"Trading_B_I"',er_trading_     sales))+70))
     ) as TradingAmount
      from table_name

    //sample json
     "R10" => array(
                "col_data" => array(
                    "CR1" => array(
                        "C1" => array(
                            "type" => "label",
                            "value" => "8.",
                        ),
                        "C2" => array(
                            "type" => "complex",
                            "value" => array(
                                "m" => "label",
                           "k" => "Turnover of sale of goods taxable @ ^d^%",
                                "v" => "4.5"
                            ),
                        ),
                          "C3" => array(
                            "type" => "textbox",
                            "value" => "",
                            "validation" => "decimal",
                          ),
                             "C4" => array(
                            "type" => "textbox",
                            "value" => "",
                            "validation" => "decimal",
                            'htmlOptions' => array('readonly' => 'readonly'),
                          ),
                          "C5" => array(
                            "type" => "",
                            "value" => "",
                          ),
                    ),
                ),
            ),


   i want "value" of   "C3" => array(
                        "type" => "textbox",
                        "value" => "",
                        "validation" => "decimal",
                    ) 
  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
    • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
    • ¥500 火焰左右视图、视差(基于双目相机)
    • ¥100 set_link_state
    • ¥15 虚幻5 UE美术毛发渲染
    • ¥15 CVRP 图论 物流运输优化
    • ¥15 Tableau online 嵌入ppt失败
    • ¥100 支付宝网页转账系统不识别账号
    • ¥15 基于单片机的靶位控制系统
    • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)