SELECT CAST(concat(year,'-',month,'-',day) AS DATE) FROM `tbl_calendar` WHERE CAST(concat(LPAD(year, 4, '0'),'-',LPAD(month, 2, '0'),'-',LPAD(day, 2, '0')) AS DATE) >= CURDATE()
2015年4月20日月曜日
2015年4月15日水曜日
postgres レコード年項目の値が存在したら、CASE文にて経過年数を表示
select
m_i_age_year,
CASE WHEN m_i_age_year = '' THEN 0
WHEN m_i_age_year <> '' THEN to_number(TO_CHAR(current_timestamp, 'yyyy'), '0000000000')-to_number(m_i_age_year, '0000000000')
END AS m_i_age_year_course_label
from tbl_estate_article;
m_i_age_year,
CASE WHEN m_i_age_year = '' THEN 0
WHEN m_i_age_year <> '' THEN to_number(TO_CHAR(current_timestamp, 'yyyy'), '0000000000')-to_number(m_i_age_year, '0000000000')
END AS m_i_age_year_course_label
from tbl_estate_article;
2015年4月14日火曜日
postgresでの方変換とケース文
select
CASE WHEN m_i_age_year = '' THEN seq/100
WHEN m_i_age_year <> '' THEN to_number(m_i_age_year, '0000000000')
END AS m_i_age_year
from tbl_estate_article;
CASE WHEN m_i_age_year = '' THEN seq/100
WHEN m_i_age_year <> '' THEN to_number(m_i_age_year, '0000000000')
END AS m_i_age_year
from tbl_estate_article;
登録:
投稿 (Atom)