Jump to content

query spanning 2 tables issue


advancedfuture

Recommended Posts

Okay here is the situation. I have a database with 2 tables, advertisements and users. I want to select all usernames from advertisements table that are advertising in a specific zipcode. It checks the users table to make sure they have the available column set to 0 and the vendor_status colum set to 1. It should then return all usernames with ads running! But I am having problems with my query. Currently what it is doing is printing out the username from BOTH the users table, and the advertisements table!

 

The tables look as follows

Table Advertisements:

username |

advertisement_title |

zip_code

 

Table Users:

 

username |

available |

vendor_status

 

 

The query I am trying to get to work is as follows.

SELECT advertisements.username FROM advertisements, users WHERE users.available='0' AND users.vendor_status='1' AND advertisements.zip_code='95119'

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.