mysql join and issues with loading data -


i working mysql code , giving me headache, upload image of tables how , how trying fetch data.

http://pasteboard.co/1kqrvuvn.png

the issue is:

i in process of doing update/insert

so query trying fetch common results both tables , if there no common stuff, want load tasktemplates tables values new.

here query trying

so below query runs in loop every record , check if record exists in temple or task tale or not.

it works if no task found, not load templates table, please guide should ..

thanks

select tasktemplates.*,task.* tasktemplates         right join task on task.templateid = tasktemplates.id           1=1         , (templateid = #val(k)# or task.id = #val(k)#)  

try it-

select tasktemplates.*,task.*  tasktemplates  left join task b  on b.templateid = a.id 

Comments

Popular posts from this blog

symfony - TEST environment only: The database schema is not in sync with the current mapping file -

twig - Using Twigbridge in a Laravel 5.1 Package -

jdbc - Not able to establish database connection in eclipse -