Jump to content

JOIN where field is empty


wjhulzebosch

Recommended Posts

Hi, i've got a website with images on it. You can tag the images, and after that, you can view images with a certain tag. I have the following tables:

table:filelist

-------------------------------------

picnum | filename | complaint

-------------------------------------

1          | fam.jpg  | 0

2          | dog.jpg  | 0

3          | cat.jpg    | 0

 

table: tags

-----------------------------

picnum | tag          | ok

-----------------------------

1          | Family      | 1

1          | Jonathan | 1

2          | Dog        | 1

2          | Animals    | 1

 

 

This works with this piece of code:

		$result_n = mysql_query(
		"SELECT picnum, filename, tag 
		FROM filelist 
		LEFT JOIN tags ON (picnum = tags_picnum) 
		WHERE tag='$tag' AND ok='1' AND complaint=0");

 

Now, i want to create a page where i can see all images, without a tag (in this example, image 3, cat.jpg). Is the above piece of code easy to convert to find images that have no tag associated with them? How can i easily find images without a tag?

 

Ty!

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.