Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to join more than one column?

Hi friends,

I have the following query in sql syntax:

select stu.name,stu.regd_id,attd.address,mks.total from student stu,marks mks,attendance attd where stu.regd_id=mks.regd_id and stu.regd_id=attd.regd_id and attd.serial in (marks.number,12,76,89);

My Intention is--- To display the student details with the  "student.ID" in marks and attendance tables and 'attd.serial' in either marks table or '12,76,89'

Note: Student.ID will have multiple entries in attendance table and I need the result with the selected attd.serial.

How to convert this SQL query to qlikview script?

I have written this with the QV Community help

load   name,       

         regd_id as id,

         

FROM

(qvd);

Inner Join

load         

         regd_id as id,

         number as numb

FROM

(qvd);

Inner Join

load   regd_id as id

         serial,

         address,

        

FROM

(qvd)where exists(numb,serial) or match(serial,12,76,89);

--But I got the result set with all the student ID's which not desired.

Please help, Any help is greatly appreciated.

1 Solution

Accepted Solutions
VishalWaghole
Specialist II
Specialist II

Hi,

Please try this one.

ATTD:
load       regd_id as id,
              serial,
              address,
FROM

(qvd)where exists(numb,serial) or match(serial,12,76,89);

left Join (ATTD)
load  name,
         regd_id as id,
FROM

(qvd);

left Join (ATTD)
load  regd_id as id,
         number as numb
FROM

(qvd);

If still have doubt then share your qvd's data with some dummy Data.

Thanks and Regards,

Vishal Waghole

View solution in original post

4 Replies
sushil353
Master II
Master II

can u post the sample data?

Not applicable
Author

Hi Sushil,

Existing sample set is

     Student                                       Marks                                              Attendance

Regd_id    Name                 Regd_id      Number                         Regd_id    Serial          Address

--------------------------            ------------------------------------                  ----------------------------------------------------

1001          arun                   1001            301                               1001        12             xyz

1002          paul                                                                          1001        201            abc

                                                                                                 1001        301            pqr

I want the result-set as

Regd_id     Name          Serial           Address

---------------------------------------------------------------

1001          arun             12                xyz

1001          arun             301              pqr

Serial No. '12' because i want it explicitly and '301' because it exists in "Marks" table.

VishalWaghole
Specialist II
Specialist II

Hi,

Please try this one.

ATTD:
load       regd_id as id,
              serial,
              address,
FROM

(qvd)where exists(numb,serial) or match(serial,12,76,89);

left Join (ATTD)
load  name,
         regd_id as id,
FROM

(qvd);

left Join (ATTD)
load  regd_id as id,
         number as numb
FROM

(qvd);

If still have doubt then share your qvd's data with some dummy Data.

Thanks and Regards,

Vishal Waghole

Not applicable
Author

Thanks Vishal,

Logic worked well.