smudholkar,
Tuesday, September 17, 2002, 12:26:05 AM, you wrote:

saadc> I am trying to write a delete query that will remove 
saadc> records from one table based on information from 
saadc> another table. In this example, there is a table called 
saadc> accounting which contains two fields: username and 
saadc> sessiontime and another table called users with two 
saadc> fields: username and password. I would like records to 
saadc> be deleted from the users table if the session time in 
saadc> the accounting table exceeds a certain value, say 1000. 
saadc> I have written the following statement:

saadc> delete from users where accounting.username = 
saadc> users.username and accounting.sessiontime > 1000;

saadc> The statement fails to execute  with the following 
saadc> error: “Unknown table ‘accounting’ in where clause” and 
saadc> I can’t figure out why. Your help is greatly 
saadc> appreciated, thanks in advance!

Because you don't specify table 'accounting' in the FROM clause. take
a look at correct syntax for multi-table delete:
    http://www.mysql.com/doc/en/DELETE.html


-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com





---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to