?
Solved

mysql if conditional help

Posted on 2011-05-11
1
Medium Priority
?
313 Views
Last Modified: 2012-06-27
help me write a query for mysql

i have a db with exp date

i want it to show only equal or above the current month and year

i tried below :
let say
curmonth : 05
curyear : 2011

query :
select * from members where expire_month >=  curmonth and expire_year >= curyear order by asc

but its skipping month 01 even the year is 2013

assist me with the right way for this query
0
Comment
Question by:mobileuni
1 Comment
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 80 total points
ID: 35737883
select * from members where ( expire_month >=  curmonth and expire_year = curyear ) OR expire_year > curyear order by asc

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Containers like Docker and Rocket are getting more popular every day. In my conversations with customers, they consistently ask what containers are and how they can use them in their environment. If you’re as curious as most people, read on. . .
In this article, I’ll talk about multi-threaded slave statistics printed in MySQL error log file.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month15 days, 17 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question