Hi all.
I have two tables:
Pages consists of an id field: PageId, and some other fields
NewsTemplate consists of another id field: PageId , and some other fields
I want to update PageId in NewsTemplate to get the value of the largest PageId in Pages, so I use the following code :
SELECT MAX(PageId) AS maxPageId FROM Pages
UPDATE NewsTemplate SET PageId = maxPageId WHERE (PageId IS NULL)
I get the following error: Invalid column name 'maxPageId'.
What's wrong with my code ?
I have two tables:
Pages consists of an id field: PageId, and some other fields
NewsTemplate consists of another id field: PageId , and some other fields
I want to update PageId in NewsTemplate to get the value of the largest PageId in Pages, so I use the following code :
SELECT MAX(PageId) AS maxPageId FROM Pages
UPDATE NewsTemplate SET PageId = maxPageId WHERE (PageId IS NULL)
I get the following error: Invalid column name 'maxPageId'.
What's wrong with my code ?
Comment