Jump to content

Recommended Posts

I have a site, http://giftpathways.com which tracks user's wish lists (mainly for Christmas lists at this time).  It keeps track of wish lists based on group, wish list items, and comments on those wish list items.

 

With my actively used group, we have 13 users with around 150 wish list items/comments.  It quickly grew beyond the scope of checking every page for changes.  I need a way to list unread items.  Specifically, I have three in mind: new members to the group (therefore, new wish lists), new wish list items, and new comments.

 

I was thinking of the best way to do this and it seems like the most accurate way is to create a new table that lists every item that was read.  So, if the item is not found, it has not been read.  The site is still very small but I'm not sure if this could quickly grow exponentially and be a bad choice as it would mean tons and tons of records.  One for every item times the number of members.

 

Anyway, I need help getting the mysql code down.  How can I compare two tables: Tables "groups" and "pageViews" track this.  I'm using an ID on pageViews to identify if the item is a groupmember, wishlist item, or comment.  Then, the ID # refers to that type and the respective table is used.

 

Group members are identification number 0.  So I need all items from "groups" returned where an entry DOES NOT exist in "pageViews" ... this is a tricky one, I think!

 

Once that new group member's page is visited, the value could be inserted.

 

As a side note, I already have a counter tracking every page view.  It probably already has sufficient information to do this!  In fact, it really does!  So users wouldn't have to start at having read nothing.  Plus, that would mean no additional table.  But I still have to solve the problem.  Any ideas?  Left and right join don't seem to help.

Link to comment
https://forums.phpfreaks.com/topic/78649-complicated-mysql-query/
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.