Skip to main content
Announcements
Global Transformation Awards! Applications are now open. Submit Entry
cancel
Showing results for 
Search instead for 
Did you mean: 
Kohli
Creator II
Creator II

Hi team

I have two tables. Table1 contains the all student details and Table contains only Passed student ID's. How can i get the only Failed student details.(I want load only fail student detilas).

             Table1:

S.ID          S.name      DOB             District

1             xxxxx          10051991      KADAPA

2             yyyyyy        10071991       CHITTORE

3            eeeeeee        05021991      NELLORE

4            ssssss          10051991      ANATAPUR

5.            nnnnn           03031991      KADAPA

              Table2:

S.ID(Passed)

1

3

4

I want load only fail student details; ( no need to load all table from the file)

EX:  OUTPUT

S.ID   S.name         DOB             District

2        yyyyy         10071991         CHITTORE

5        nnnnn          03031991        KADAPA

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

i think you may need an Alias field here .. no you won;t

Table2:

load * inline [

S.ID

1

3

4

];

load * inline [

S.ID,S.name,DOB,District

1,xxxxx,10051991,KADAPA

2,yyyyyy,10071991,CHITTORE

3,eeeeeee,05021991,NELLORE

4,ssssss,10051991,ANATAPUR

5,nnnnn, 03031991,KADAPA

] where not Exists([S.ID]);

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

13 Replies
Anil_Babu_Samineni

May be use Not Exists([S.ID]) for your second one

Load * From Table1;

Load * From Table2 where Not Exists([S.ID]);

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

I would just change the order here

Load * From Table2;

Load * From Table1

Where Not Exists([S.ID]);

neha_shirsath
Specialist
Specialist

Hi,

You can use where not exist or you can do -

table 1

right join

table 2

Thanks,

Neha

vinieme12
Champion III
Champion III

i think you may need an Alias field here .. no you won;t

Table2:

load * inline [

S.ID

1

3

4

];

load * inline [

S.ID,S.name,DOB,District

1,xxxxx,10051991,KADAPA

2,yyyyyy,10071991,CHITTORE

3,eeeeeee,05021991,NELLORE

4,ssssss,10051991,ANATAPUR

5,nnnnn, 03031991,KADAPA

] where not Exists([S.ID]);

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
Kohli
Creator II
Creator II
Author

But i take the same data from database, but it's not working.

ODBC CONNECT TO co;

Table1:

LOAD SID;

SQL SELECT *

FROM mohan.dbo.studentpassdetails;

Table2:

LOAD SID,

    Student,

    address,

    DOB;

SQL SELECT *

FROM mohan.dbo.Studentdetails

where not exists SID;

Please help me

;

sunny_talwar

Try putting parenthesis around SID within Where not Exists()

Table1:

LOAD SID;

SQL SELECT *

FROM mohan.dbo.studentpassdetails;

Table2:

LOAD SID,

    Student,

    address,

    DOB;

SQL SELECT *

FROM mohan.dbo.Studentdetails

Where not Exists(SID);

Kohli
Creator II
Creator II
Author

i got error in this type:

SQL##f - SqlState: 37000, ErrorCode: 102, ErrorMsg: [Microsoft][SQL Server Native Client 11.0][SQL Server]Incorrect syntax near 'SID'.

SQL SELECT *

FROM mohan.dbo.Studentdetails

where not Exists (SID)

sunny_talwar

My bad, try this

Table1:

LOAD SID;

SQL SELECT *

FROM mohan.dbo.studentpassdetails;

Table2:

LOAD SID,

    Student,

    address,

    DOB

Where not Exists(SID);

SQL SELECT *

FROM mohan.dbo.Studentdetails;

Kohli
Creator II
Creator II
Author

Yes It's working. Thanks sunny.

At the same time, If i have

Table1:

SID1

Table2

SID

How can i use that statement. (where not Exists(SID))