Ver Mensaje Individual
  #3 (permalink)  
Antiguo 30/01/2008, 12:40
Avatar de Sergestux
Sergestux
 
Fecha de Ingreso: agosto-2007
Ubicación: Tapachula
Mensajes: 1.218
Antigüedad: 16 años, 9 meses
Puntos: 20
Re: Error usando subconsulta

Cita:
select * from aforo where nov_id<>0 and (select nov_id from novedades where nov_aprobacion=1 and nov_subtipo=5)
Esta mal planteada tu consulta por que le estas diciendo que te SELECCIONE todo de la tabla aforo DONDE nov_aprobacion=1 Y (aca esta el error) X Valor, Cuando deberias ponerle Y (Una condicion)
nov_id=(subconsulta que solo debe regresar un registro)

Algo asi si, siempre y cuando la subconsulta te regrese un solo valor
Código PHP:
 select from aforo where nov_id<>and nov_id=(select nov_id from novedades where nov_aprobacion=and nov_subtipo=5