join - MySQL sum up some CASE WHEN functions -
join - MySQL sum up some CASE WHEN functions -
is there possibility minimize 3 case-functions 1 while i'm expecting 3 different expressions case?
so case-calls dependent on 1 value (con.category_id). hope can help me clean sql statement conserving whole functionality.
select unix_timestamp(con.content_date_publishing) time, case when con.category_id not null con.category_id else 0 end category_id, case when con.category_id not null cat.category_name_de else null end category_name v5_content con, v5_category cat content_id = 2 , case when con.category_id not null con.category_id = cat.category_id else 1 end limit 1
looks you're missing left join
operator.
select unix_timestamp(con.content_date_publishing) time, cat.category_id, cat.category_name_de v5_content con left bring together v5 category cat on con.category_id = cat.category_id content_id = 2;
mysql join case
Comments
Post a Comment