Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Database > SQL Language
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 28th, 2004, 03:26 PM
Authorized User
 
Join Date: Jun 2003
Location: Rochester, NY, USA.
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 !
Reply With Quote
  #2 (permalink)  
Old October 29th, 2004, 09:51 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:15 PM.


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