Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why this sentence doesn't work?

Status
Not open for further replies.

beltijs

Programmer
Sep 11, 2003
25
AR
I'm using mysql 4.0.21 and Toad to run this query. The message i'm receiving is that there is a Syntax error, where?

select a.id_opcion, a.nombre, a.campo, a.visible, b.id_usuario,
if(b.ancho is null, 50, b.ancho) as ancho, b.posicion
from det_rmen as a
left join
(select *
from rmen_usu
where id_usuario = 'generico') as b
on (a.id_opcion = b.id_opcion and a.campo = b.campo)
where (b.id_usuario='generico') or (b.id_usuario is NULL)
order by id_opcion, posicion;


can anyone helpme, i have spend 2 hours looking for a solution......
 
4.0.21 does not support derived tables -- the subselect in the JOIN clause
Code:
select a.id_opcion
     , a.nombre
     , a.campo
     , a.visible
     , b.id_usuario
     , coalesce(b.ancho,50) as ancho
     , b.posicion 
  from det_rmen as a 
left outer
  join from rmen_usu as b
    on a.id_opcion = b.id_opcion  
   and a.campo = b.campo
   and b.id_usuario = 'generico'
order 
    by a.id_opcion
     , b.posicion

rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (course starts January 9 2005)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top