Я использую этот запрос для нумерации страниц
SELECT *
FROM
(SELECT ROW_NUMBER() OVER (ORDER BY {0} {1}) AS RowNum, *
FROM Cars
WHERE IdOwner = {2}) AS Rows
WHERE RowNum > {3} AND RowNum < {4}
Я хочу сделать запрос разбивки на две таблицы, а не только на одну, как я делаю сейчас.
SELECT *
FROM
(SELECT ROW_NUMBER() OVER (ORDER BY {0} {1}) AS RowNum,
Cars.Id, Cars.Make, Cars.Model, Color.Name
FROM Cars
INNER JOIN Color ON Cars.ColorId = Color.Id
WHERE IdOwner = {2}) AS Rows
WHERE RowNum > {3} AND RowNum < {4}
Я получаю Incorrect syntax near the keyword 'WHERE'.
Проблема решена. Спасибо, ребята, я такой нуб: (
SELECT *
FROM ( SELECT ROW_NUMBER() OVER ( ORDER BY c.Id ) AS RowNum,
c.Id, c.Make, c.Model, d.ColorName
FROM Car AS c
INNER JOIN Color AS d
ON c.ColorId = d.Id WHERE c.IdOwner=1 ) AS Rows
WHERE RowNum > 0 AND RowNum < 11