Copy link to clipboard
Copied
I am just tweaking a page here:
http://www.goodsafariguide.net/africanhorseback/index102.php
Basically just changing the nominations history part to just show nominations from 2013 and 2011, as some of the palces had too long a list of nominations.
So the original SQL query was:
SELECT NominationID, Category, Year, Finalist, Winner, LodgeID FROM nominations WHERE LodgeID = 288 ORDER BY Year DESC, CATEGORY ASC
So I want it to now display nominations for that LodgeID, but just for 2011 and 2013, which I thought should just be:
SELECT NominationID, Category, Year, Finalist, Winner, LodgeID FROM nominations WHERE LodgeID = 288 AND (Year='2013' OR '2011') ORDER BY Year DESC, CATEGORY ASC
But that isn't working. I've tried a few variations, with and without the inverted commas, but can't seem to get it.
Any suggestions?
Try this:
SELECT NominationID, Category, Year, Finalist, Winner, LodgeID FROM nominations WHERE (Year='2013' OR Year='2011') AND LodgeID = '288' ORDER BY Year DESC, CATEGORY ASC
if you wanted a run of years like 2011 , 2012 and 2013 you could use:
SELECT NominationID, Category, Year, Finalist, Winner, LodgeID FROM nominations WHERE Year BETWEEN '2011' AND '2013' AND LodgeID = '288' ORDER BY Year DESC, CATEGORY ASC
Copy link to clipboard
Copied
Try this:
SELECT NominationID, Category, Year, Finalist, Winner, LodgeID FROM nominations WHERE (Year='2013' OR Year='2011') AND LodgeID = '288' ORDER BY Year DESC, CATEGORY ASC
if you wanted a run of years like 2011 , 2012 and 2013 you could use:
SELECT NominationID, Category, Year, Finalist, Winner, LodgeID FROM nominations WHERE Year BETWEEN '2011' AND '2013' AND LodgeID = '288' ORDER BY Year DESC, CATEGORY ASC
Copy link to clipboard
Copied
Thank you! I didn't think to reverse the order like that.
The reason there's no 2012 is because the 2011 awards were in Nov 11, then the next ones were Jan 2013. So they've kind of skipped a year.
Copy link to clipboard
Copied
look closer ... it's not just the order!
i have (Year='2013' OR Year='2011') you have????
Copy link to clipboard
Copied
D'oh! Wood for trees and all that. Thanks again.