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
https://forums.phpfreaks.com/topic/67159-table-join-with-conditions-and-exception/
Share on other sites

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.