Mysql命令按字段子查询和变量不起作用

时间:2016-04-12 13:57:50

标签: mysql

我有这个查询。

    guard let theBoos = mutableObjects as? [Dictionary<String, AnyObject>] else {
        return
    }

    for var theBoo in theBoos {
        if (theBoo["name"]  as! String) == "BookB" {
            print (theBoo["isRead"]) //see Console Output
            theBoo["isRead"] = "true"  //this gets error "Cannot assign to immutable expression of type ' AnyObject?!'"
        }
    }

我希望按此变量排序但不起作用

如果我写这个,那就是正常工作和订购数据。

@var = "5,3,2,4,1,11";

SET @var := (select faq_order from config);


SELECT faq_id, faq_q,faq_a
FROM faqs
ORDER BY FIELD(faq_id, @var);

子查询也不起作用。

0 个答案:

没有答案