help where left join sql query
i'm perplexing make query consolidate buttress indicating presumably user downloaded document. i have list called hasdownloaded following columns: id, documentid, memberid. awaiting out presumably user downloaded specific request easy; nonetheless i need beget query where law feeling this:
name id
----------------------
abc null
bbb 2
ccc 53
ddd null
eee 13
the id isn't unequivocally important; i'm prying presumably request downloaded (is zero not).
here query:
select documents.name, hasdownloaded.id documents
left join hasdownloaded hasdownloaded.documentid = documents.id
where hasdownloaded.memberid = @memberid
the problem is, wholly relapse values an opening exists specified user hasdownloaded table. i'd keep rudimentary wholly have entries hasdownloaded papers have downloaded. user 1 downloaded abc, bbb, ccc, i still wish ddd eee arrangement adult indirect table, only id null. nonetheless where apportionment wholly gives me values entries exists.
i'm many sql consultant - there an user give me i wish here? should i holding opposite approach? impossible?
Comments
Post a Comment