Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Database > SQL Language
|
SQL Language SQL Language discussions not specific to a particular RDBMS program or vendor.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Language section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 28th, 2004, 03:26 PM
Authorized User
 
Join Date: Jun 2003
Posts: 60
Thanks: 0
Thanked 0 Times in 0 Posts
Default Simple Udpate SQL Problem

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 !
 
Old October 29th, 2004, 09:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi ank2go,

Can you explain your criteria usage in simple english and what you are trying to Update?

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Simple Question - SQL Statement mrideout BOOK: Beginning ASP.NET 1.0 2 January 11th, 2005 09:28 AM
simple sql aylin_sk SQL Language 4 December 31st, 2004 11:49 AM
Very Simple SQL Question?? mrideout BOOK: Beginning ASP.NET 1.0 3 September 20th, 2004 08:07 PM
Simple SQL Question cjmarek Classic ASP Databases 1 July 10th, 2004 04:11 AM
Simple Question - SQL for retrieving different row wanda46 Access 5 June 9th, 2004 01:17 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.