如何为windows azure编写连接查询

时间:2013-10-03 11:32:50

标签: azure

我是windows azure的新手。请帮帮我。

我该怎么写这个查询:

"SELECT catchup.*,news.text from catchup,news where news.deviceID = catchup.deviceID AND news.name = '$name' ORDER BY id DESC";

我用这种格式来写它

mssql.query('SELECT t.text, t.complete, p.description FROM ToDoItem as t INNER JOIN Priority as p ON t.priority = p.number', {
        success: function(results) {
            console.log(results);
        },
        error: function(err) {
            console.log("error is: " + err);
    });

但它给出错误代码500.还有如何传递参数。

1 个答案:

答案 0 :(得分:0)

var sql = "SELECT t.text, t.complete, p.description FROM ToDoItem as t INNER JOIN Priority as p ON t.priority = p.number AND t.text = ?";
var name = '$name';

mssql.query(sql, [name], {
      success: function(results) {
         console.log(results);
      },
      error: function(err) {
                console.log("error is: " + err);
      }
   });