I’m on sql 2000.
I am getting all the banners to display on a website.
If the displayedCount != -1, then always get the row. Otherwise, I need to make sure it isn’t larger than the maxViewCount column.
So the table is like:
bannerID viewCount maxViewCount
1 -1 0
2 100 200
3 0 200
4 201 200
So I need a select statement that will return bannerID’s 1, 2, 3
- 1 is returned because the viewCount is -1 (unlimited)
- 4 isn’t returned since it has a viewCount > maxViewCount.
Is this possible with a SELECT statement or it requires a temp table?
1 Answer