Link to home
Start Free TrialLog in
Avatar of jay-are
jay-areFlag for United States of America

asked on

Delete help

Hello Experts!
I'm trying to do something like this:

DELETE FROM FINANCE
WHERE vehmaster.status = '1'  (SELECT * FROM FINANCE INNER JOIN VEHMASTER ON FINANCE.STKNUM = VEHMASTER.STKNUM )

but I get this error:  The column prefix 'vehmaster' does not match with a table name or alias name used in the query.

Do I have the incorrect syntax?
Avatar of Jim Horn
Jim Horn
Flag of United States of America image

What's the relevance of the (SELECT * FROM FINANCE INNER JOIN....) part?
Perhaps...

DELETE FROM FINANCE
INNER JOIN VEHMASTER ON FINANCE.STKNUM = VEHMASTER.STKNUM
WHERE vehmaster.status = '1'
ASKER CERTIFIED SOLUTION
Avatar of Anthony Perkins
Anthony Perkins
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of softplus
softplus

DELETE FROM FINANCE
WHERE STKNUM IN (SELECT STKNUM FROM VEHMASTER WHERE status = '1' )
should he try them all out and see which one deletes the most records? :)))
set a timer to them and see which one executes fastest.  
>>should he try them all out and see which one deletes the most records?<<
There are only two that are syntactically correct :)  Perhaps he can average out.  Randomly pick one or he other ....
>>should he try them all out and see which one deletes the most records? :)))

I suggest DELETE * FROM FINANCE ;)
>>DELETE * FROM FINANCE<<
I miss that MS Access syntax :)
jay-are,

This question is considered now to be technically abandoned:
03/23/2005 500 VB help!  Open Visual Basic
https://www.experts-exchange.com/questions/21362341/VB-help.html

See here for more info:
Nobody answered my question.  What do I do?
https://www.experts-exchange.com/Databases/Microsoft_SQL_Server/help.jsp#hi71
Avatar of jay-are

ASKER

acperkins solution was the first one to work properly!

PePi, unfortunately I accidently did a "DELETE FROM FINANCE"...  :(   had to rebuild the whole thing.
Avatar of jay-are

ASKER

acperkins, I posted a "please delete my question" in community service...

Thanks!
Thanks and I appreciate the points.