mysql - Easier way of making this SQL query nicer -



mysql - Easier way of making this SQL query nicer -

i've got mysql query here..

/*** * ugly self joining sql. * want parent's name have bring together same table * joining on child_row.parent_id = parent_row.id * don't remove limit this... might bad. */ $sql = 'select cnode.*, pnode.name parent_name '; $sql.= ' t_nodes cnode left bring together t_nodes pnode '; $sql.= ' on cnode.parent_id = pnode.id '; $sql.=' cnode.id = '.$id.' limit 1';

is there way of making more elegant?

nothing sql improve legibility in php source:

$sql = " select cnode.*, pnode.name parent_name t_nodes cnode left bring together t_nodes pnode on cnode.parent_id = pnode.id cnode.id = $id limit 1 ";

mysql sql database

Comments

Popular posts from this blog

c# - Move local mssql database to webhosted MYSQL -

java - How to pass parameters between Request-Scoped Controllers? -

string - what is the difference between "some" == "some\0" and strcmp("some","some\0") in c++? -