Ver Mensaje Individual
  #1 (permalink)  
Antiguo 19/07/2011, 08:26
Avatar de wsoul
wsoul
 
Fecha de Ingreso: octubre-2010
Mensajes: 190
Antigüedad: 13 años, 6 meses
Puntos: 13
Consulta SQL php, con UNION

Hola,

haber si alguien me puede hechar una mano, que creo que estando tanto tiempo seguido programando me esta dejando tonto.

tengo estas tablas con sus respectivos campos

tags: id - idnoticia - tag - url
noticias: id - estado

y quiero sacar las noticias que tengan un tag en especial siempre que su estado sea 1.

Código PHP:
$consulta mysql_query("SELECT * FROM tags WHERE tags.url='{$categoria}' UNION SELECT * FROM noticias WHERE noticias.estado='1' AND noticias.id=tags.idnoticia"); 
help me pls!
__________________
Compra y Vender artículos en https://www.losredactores.com o una comunidad de webmasters ? https://webeamos.com