944,142 Members | Top Members by Rank

Ad:
  • MS SQL Discussion Thread
  • Unsolved
  • Views: 780
  • MS SQL RSS
Oct 24th, 2007
0

Problem

Expand Post »
Hi,
I have a problem. I have questions, to a question there can be arbitrary groups and to every group there can be arbitrary conditions. To have permission to “see” an question you have to have at least one condition from every group which is in the question.

I have three tables: Question, QuestionGroup and GroupCondition.

Question
QuestionId | Bla | Bla
15 | as | asd
16 | ef | asdas

QuestionGroup
fkey_GroupID | fkey_QuestionID
1 | 15
2 | 15
3 | 16

GroupCondition
Pkey_GroupId | fkey_ConditionId
1 | 101
1 | 102
2 | 103
3 | 101
3 | 102
3 | 103

So I need a select which returns all QuestionId from Question depending on the conditions I have. So to get QuestionId (15) I need following: (101 or 102) and (103), to get acess to QuestionId 16 I need (101 or 102 or 103). I hope I have been clear enough..

I do not know if it is sql server 2000 or 2005 its goint to be on.

Best regards

carl
Similar Threads
cok
Reputation Points: 10
Solved Threads: 0
Newbie Poster
cok is offline Offline
1 posts
since Oct 2007
Nov 1st, 2007
0

Re: Problem

You simply need to join the tables to get the desired output. Try from your side and post the query that you have tried to get further clarification on the topic .
Featured Poster
Reputation Points: 665
Solved Threads: 427
Posting Genius
debasisdas is offline Offline
6,406 posts
since Feb 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in MS SQL Forum Timeline: Referencing using T-SQL?
Next Thread in MS SQL Forum Timeline: Odd issue with LIKE operator





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC