i am having 4 table dat is:

**Question\_Paper\_Master:** this table contain question id of those question for selected for test(exam).

```
Question_Paper_Id   Question_Id   Test_Id
1                     1              1 
2                     2              1 
3                     3              1 
4                     4              1 

```

**Question\_Bank:** this table contain list of questions.

```
Question__Id      Question            Question_Type_id
1                     abc               1 
2                     pqr               1 
3                     lmn               1 
4                     xyz               1 

```

**Question\_Type:** this table contain type for question dat is single choice(radio button) or multiple choice (checkbox).

```
Question__type_id        Question_type     
1                        single choice   
2                        multiple choice       

```

**Option\_Master:** this table contain list of option for questions.

```
option__Id        Question_id            option
1                     1                    a 
2                     1                    b 
3                     1                    c 
4                     1                    d
.
.
.

```

now problem is i want to fetch option and its type(single or multiple) by question and get output in **datatable**.

My query is as :

```
select q.Question,o.Options,t.Question_Type 
    from Question_Paper_Master Qp,Question_Bank Q,Option_Master o,Question_Type_Master T
    where qp.Question_Id=q.Question_Id and q.Question_Id=o.Question_Id
    and q.Question_Type_Id=t.Question_Type_Id
    and qp.Test_Id=9 

```

but output is coming as:

```
question      option      questiontype
 abc           a            singlechoice
 abc           b            single choice
 abc           c            singlechoice
 abc           d            single choice
 pqr           a            singlechoice
 pqr           b            single choice
 pqr           c            singlechoice
 pqr           d            single choice

```

i want output like this:

```
question      option      questiontype
 abc           a           singlechoice
               b
               c
               d
pqr            a            singlechoice
               b
               c
               d

```