Jump to content

table join with conditions ... and exception?


drgnjucr

Recommended Posts

I'm creating an NFL Elimination application, and I'm trying to get the users picks to display in a table.  I am able to get the data I need and populate it, but now I want to limit the results to everyone and their picks up until the previous week, but for the current user, show their current week's pick only.

 

I hope I explained that correctly.  I have two SQL statements today, one which pulls all the info, and one that only shows up until the previous weeks. If I could somehow take the code not to display the current weeks, except....... that would be prefect.

 

 

 

SELECT tbl_nflelim_picks.*, tbl_nflelim_teams.team_abbr, tbl_nflelim_users.name, tbl_nflelim_users.email
FROM tbl_nflelim_picks
LEFT
JOIN tbl_nflelim_teams
        ON tbl_nflelim_teams.teamIndex = tbl_nflelim_picks.pick
        LEFT
        JOIN tbl_nflelim_users
        ON tbl_nflelim_users.email = tbl_nflelim_picks.email
        WHERE tbl_nflelim_picks.week != '$_SESSION[thecurrentweek]'
        ORDER 
       BY tbl_nflelim_users.name, tbl_nflelim_picks.week

 

Is something like this possible to do?

 

 

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.