Bug Fix - Ensure DataQuery::exists() SQL is both valid MySQL and T-SQL

The original SQL statement is not valid T-SQL for use with SQL Server
This commit is contained in:
Joe Harvey 2021-02-08 17:22:20 +00:00
parent 2f5d976072
commit 33365b92f3
1 changed files with 1 additions and 1 deletions

View File

@ -479,7 +479,7 @@ class DataQuery
}
// Wrap the whole thing in an "EXISTS"
$sql = 'SELECT EXISTS(' . $statement->sql($params) . ')';
$sql = 'SELECT CASE WHEN EXISTS(' . $statement->sql($params) . ') THEN 1 ELSE 0 END';
$result = DB::prepared_query($sql, $params);
$row = $result->first();
$result = reset($row);