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

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -