Link to home
Start Free TrialLog in
Avatar of dgrafx
dgrafxFlag for United States of America

asked on

syntax problem i guess

don't work on mysql much but here goes:

I'm trying to
      insert into tbl
      (col1,col2)
      select 'hello','world'
      where not exists (select 1 from tbl where col1 = 'hello')

get an error
i know that on oracle (which i don't work on much either) one needs to select FROM DUAL
is there a requirement like that on mysql or ???

thanks
ASKER CERTIFIED SOLUTION
Avatar of Pratima
Pratima
Flag of India 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 dgrafx

ASKER

"DUAL is purely for the convenience of people who require that all SELECT statements should have FROM and possibly other clauses. MySQL may ignore the clauses. MySQL does not require FROM DUAL if no tables are referenced"
taken from dev.mysql.com

whats your opinion on this?
note that i cannot access that db right now or i would just try it - sorry.
SOLUTION
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 dgrafx

ASKER

thanks guys