缺少SQL中的关键字

时间:2015-12-07 00:36:51

标签: sql

我正在尝试向所有客户展示待处理订单以及与这些订单相关联的员工。但无论我将子查询放在哪里,我都会收到丢失的关键字错误。

<script>
$('[data-toggle="validator"]').validator({
    custom: {
        chkgrp: function ($el) {
            console.log("Some debug output, if it is triggered at all" + $el);
            var name = $el.data("chkgrp");
            var $checkboxes = $el.closest("form").find('input[name="' + name + '"]');

            return $checkboxes.is(":checked");
        }
    },
    errors: {
        chkgrp: "Choose atleast one!"
    }
}).on("change.bs.validator", "[data-chkgrp]", function (e) {
    var $el = $(e.target);
    console.log("Does is even work? " + $el);
    var name = $el.data("chkgrp");
    var $checkboxes = $el.closest("form").find('input[name="' + name + '"]');

    $checkboxes.not(":checked").trigger("input");
});

1 个答案:

答案 0 :(得分:0)

我认为您需要最外层查询中的where子句:

SELECT C.CustomerID, C.FirstName, C.LastName, OT.Date_Ordered, OT.Status, 
       CSR.EmployeeID, CSR.LastName, CSR.FirstName
FROM Customer C JOIN
     CreditCard CC
     ON C.CustomerID = CC.CustomerID JOIN
     Order_Table OT 
     ON CC.CreditCard_Number = OT.CreditCard_Number JOIN
     CustomerService_Rep CSR
      ON CSR.EmployeeID = OT.EmployeeID 
WHERE OT.Status = 'Pending'
GROUP BY C.CustomerID, C.FirstName, C.LastName, OT.Date_Ordered, OT.Status, CSR.EmployeeID, CSR.LastName, CSR.FirstName;

子查询对此没有用处。