sql - Adding query inside concat for images having specific imageType such as profile or poster in MySql select -


i have image table in have 2 imagetype called profile , poster in imagetype field , have on image path storing images url.

if possible want like:

concat('/images/', select i.path i.imagetype='**poster**') posters  concat('/images/', select i.path i.imagetype='**profile**') profiles  select date_format(f.filmreleasedate,'%d %b %y')filmreleasedate, f.filmname, concat('/images/', i.path) profiles, concat('/images/', i.path) posters, f.filmdirector, url films f     inner join images on f.filmid = i.filmid     f.filmreleasedate >= now()      group i.filmid     order date(f.filmreleasedate)     limit 0 , 10 

you can use case

select date_format(f.filmreleasedate,'%d %b %y')filmreleasedate, f.filmname,    case when  i.imagetype='**profile**'  concat('/images/', i.path) end profiles,    case when  i.imagetype='**poster**' concat('/images/', i.path) end posters, f.filmdirector, url films f     inner join images on f.filmid = i.filmid     f.filmreleasedate >= now()      group i.filmid     order date(f.filmreleasedate)     limit 0 , 10 

for gettin both try inner join same table

  select date_format(f.filmreleasedate,'%d %b %y')filmreleasedate, f.filmname,          concat('/images/', i.path) profiles,          concat('/images/', j.path) posters, f.filmdirector, url films f     inner join images on f.filmid = i.filmid     inner join images j on (j.filmid = i.filmid)     f.filmreleasedate >= now()      , i.imagetype='**profile**'     , j.imagetype='**poster**'     group i.filmid     order date(f.filmreleasedate)     limit 0 , 10 

Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -