CREATE TABLE IF NOT EXISTS `userAwardStat` (
`id` int(6) unsigned NOT NULL,
`user_id` int(6) unsigned NOT NULL,
`last_date` date NOT NULL,
`count` int(6) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
SELECT IF(last_date = DATE_ADD( CURRENT_DATE, INTERVAL - 1 DAY ), 'вчера', IF(last_date = CURRENT_DATE, 'сегодня', 'более 2х дней назад')) as 'result' FROM userAwardStat WHERE user_id=3