Jump to content

Is it possible to search one table while using another as a condition?


pault

Recommended Posts

(PHP version 5.2.14)

 

My situation is that I have table of Users and a table of Adverts which are created by those Users. I want to search the Adverts, selecting for for dates, price, etc, which is all very straightforward. The difficulty comes in that the Users are sometimes enabled and sometimes disabled, and when they are disabled, none of their adverts should appear.

 

What I need then is something like "select * from Adverts where (adverts.dates=etc, etc) AND where User.enabled=true"

 

I've been looking at joins and subqueries but the examples don't seem to match what I am looking for. Grateful for any help.

most likely possible...

 

I want to search the Adverts, selecting for for dates, price, etc, which is all very straightforward

 

post the code that you are using for that.... and additional your table's definitions

 

a simple join should solve your issue if your table design is correct.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.