var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: sql query question
Hi , to describe what i am looking for , please take a look to these 3 tables :
now i need a query to return :
g_name - a_name
if there is no article for any group, then a_name would be null
i tried select from groups and rels tables, but my result set doesn't contain groups that have no articles in rels table !
any idea ?
First off, the rels table doesn't need r_id - a composite key of g_id and a_id will suffice
Ok, so you want to know all groups that have no articles assigned, right?
ON rels.g_id = groups.g_id
WHERE rels.g_id IS NULL
thanx gvee for you answer but i think i couldn't make my question clear :
the result i want is a select for columns g_name And a_name between these tables.
like this :
select g_name,a_name from rels r left join groups g on g.g_id = r.g_id left join articles a on a.a_id = r.a_id
the problem in this sql query is : it doesn't return groups that have no articles
, i need such query to return all groups while there is no article !
FROM groups AS g
JOIN rels AS r
ON r.g_id = g.g_id
JOIN articles AS a
ON a.a_id = r.a_id
thanx, it seems to work .