Hi,
Please help.
I have a simple update sql:
UPDATE dbo.tbl01
SET par = 'Y'
FROM dbo.tbl01 tbl01
INNER JOIN
( SELECT name
FROM dbo.tbl01
WHERE recordtype = 'P' and active = 'Y' and par = 'Y' ) ppr ON tbl01.name = ppr.name
WHERE tbl01.recordtype <> 'P' and tbl01.active = 'Y'
the error message is:
The column prefix 'ppr' does not match with a table name or alias name used in the query.
But when I do this it doesn't error out:
SELECT *
FROM dbo.tbl01 tbl01
INNER JOIN
( SELECT name
FROM dbo.tbl01
WHERE recordtype = 'P' and active = 'Y' and par = 'Y' ) ppr ON tbl01.name = ppr.name
WHERE tbl01.recordtype <> 'P' and tbl01.active = 'Y'
Any ideas? and Thanks !
Please help.
I have a simple update sql:
UPDATE dbo.tbl01
SET par = 'Y'
FROM dbo.tbl01 tbl01
INNER JOIN
( SELECT name
FROM dbo.tbl01
WHERE recordtype = 'P' and active = 'Y' and par = 'Y' ) ppr ON tbl01.name = ppr.name
WHERE tbl01.recordtype <> 'P' and tbl01.active = 'Y'
the error message is:
The column prefix 'ppr' does not match with a table name or alias name used in the query.
But when I do this it doesn't error out:
SELECT *
FROM dbo.tbl01 tbl01
INNER JOIN
( SELECT name
FROM dbo.tbl01
WHERE recordtype = 'P' and active = 'Y' and par = 'Y' ) ppr ON tbl01.name = ppr.name
WHERE tbl01.recordtype <> 'P' and tbl01.active = 'Y'
Any ideas? and Thanks !