drgnjucr Posted August 29, 2007 Share Posted August 29, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/67159-table-join-with-conditions-and-exception/ Share on other sites More sharing options...
btherl Posted August 29, 2007 Share Posted August 29, 2007 So what you want is - Picks for previous weeks for all users - Picks for current week for current user Is that right? And what does the SQL you posted give? Quote Link to comment https://forums.phpfreaks.com/topic/67159-table-join-with-conditions-and-exception/#findComment-336980 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.