mysql - Select add additional row for prompt with join -


i have following query:

select     a.id,     concat( a.name, ' -', b.title, '-') title     tourist_tour     left join ategories b on a.category=b.id order a.name asc 

i add row @ start of results id 0 , title "please select tour".

i have seen answers using

select 0, "select tour" union rest of select query 

but not work join.

any ideas?

thanks

 select 0 id, "select tour" title  union  select      a.id,      concat( a.name, ' -',  ifnull(b.title,' '), '-') title       tourist_tour  left join categories b on a.category=b.id  order case when id = 0 id else title end 

sqlfiddle : http://www.sqlfiddle.com/#!2/310cc3/1/0


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -