I am writing an Iphone app and using sqlite as my database. I have a discount for objects if they are between a certain range (MIN and MAX), but the problem is when i do my query, the discounts seems to apply beyond that range as well. Not sure how to do it properly.
For example, I want the range between 36(MIN) to 60(MAX).
The sql statement looks like this:
NSString *queryString = [NSString stringWithFormat:@"SELECT * FROM DISCOUNT WHERE PACKAGEID = '%@' AND CATEGORYID = '%@' AND '%@' >= MIN ORDER BY MAX DESC ",item.packageid,item.categoryid,item.discount];
This code is my senior’s. Need to change it.. Need some help on it… What am i doing wrong?
add
AND '%@' <= MAXin the query at the end afterAND '%@' >= MINYour query should look like