Editor Where Clause with SubSelect : Incorrect syntax near '@P1'

Editor Where Clause with SubSelect : Incorrect syntax near '@P1'

ad824aad824a Posts: 20Questions: 4Answers: 1

Hi,
Im trying to build an editor instance that uses a WHERE IN (subselect) condition.

Here is the js to build the editor instance: live.datatables.net/rikameva/1/edit

When I load the table I get the following error:

"SQLSTATE[42000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near '@P1'."

Does anyone know what P1 is? The produced SQL runs correctly when I execute it in SQL Server Management Studio:

SELECT [ID] as 'ID', [Task] as 'Task', [SubProjectID] as 'SubProjectID', [DueDate] as 'DueDate', [Comments] as 'Comments', [CompletionDate] as 'CompletionDate' FROM [tUserSubTaskList] WHERE [UserTaskID] IN (SELECT ID FROM tUserTaskList WHERE MasterTaskID =
(SELECT MasterTaskID FROM tUserTaskList WHERE ID = 6) AND SubProjectID IN
(SELECT ID FROM tSubProjectOverview WHERE ProjectID = (SELECT ProjectID FROM tSubProjectOverview WHERE ID = 1)))

Answers

  • tangerinetangerine Posts: 3,365Questions: 39Answers: 395

    Your example doesn't run because the Javascript section consists entirely of PHP code.

  • ad824aad824a Posts: 20Questions: 4Answers: 1

    lol oops. I actually just pasted it in live.datatables because I couldn't get the markdown formatting to work.... and then accidentally called it JS. I was hoping someone could just look at the code and see if there was an obvious issue. Or maybe someone just knew what the @P1 was referring to

This discussion has been closed.