Skip to main content
Announcements
Customer Spotlight: Discover what’s possible with embedded analytics Oct. 16 at 10:00 AM ET: REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
nikhilgarg
Specialist II
Specialist II

Help regarding LOAD !!

HEy,

I have 2 different tables having 3 common columns:

StartDate , EndDate , Event.

Now i have to include a new column for each matching (StartDate , EndDate , Event) in first column.


How can i do this in LOAD statement ??


Thanks

5 Replies
anbu1984
Master III
Master III

Temp:

Load StartDate , EndDate , Event,1 As Flag1 Inline [

StartDate , EndDate , Event

1/1/2014,10/10/2014,1

1/1/2014,11/10/2014,1

1/1/2014,12/10/2014,1 ];

Join

Load StartDate , EndDate , Event,1 As Flag2 Inline [

StartDate , EndDate , Event

1/1/2014,10/10/2014,1

2/1/2014,11/10/2014,1

1/1/2014,12/10/2014,1 ];

NoConcatenate

Final:

Load *,If(Flag1=Flag2,'Matching') As NewField Resident Temp;

Drop table Temp;

datanibbler
Champion
Champion

Hi,

there is a number of ways:

1) You load one table first, and include WHERE EXISTS clauses in the other two LOADs so that only matching entries are loaded at all.

2) You join the three tables - or just join the two date_fields from two of the tables to the third - so you have all the date_fields (9 in total) in one table and you can easily see where they match and create a new field based on that.

HTH

Best regards,

DataNibbler

its_anandrjs

Hi,

You can try many ways for this

1. Join this table or create single one

2. Make single key

If you want single field in another table then do like below load script and let me know

Tab1:

Load StartDate, EndDate, Event, StartDate&EndDate&Event as Key;

LOAD * INLINE [

    StartDate, EndDate, Event

    1/1/2014, 10/10/2014, 1

    1/1/2014, 11/10/2014, 1

    1/1/2014, 12/10/2014, 1

];

NoConcatenate

Tab2:

load StartDate&EndDate&Event as Key2;

LOAD * INLINE [

    StartDate, EndDate, Event

    1/1/2014, 10/10/2014, 1

    2/1/2014, 11/10/2014, 1

    1/1/2014, 12/10/2014, 1

];

New:

NoConcatenate

Load

Key as %Key

Resident Tab1;

Left Join

Load

Key2 as %Key

Resident Tab2;

Regards

Anand

nikhilgarg
Specialist II
Specialist II
Author

Hey,

I ahve attached the samples.

In this i have to put Downtime_Starttime and DOwntime_EndTime in front of matching STARTDate , EndDate and Event.

But using join it add another line instead.

Pla Help.

Thanks

nikhilgarg
Specialist II
Specialist II
Author

Hey,

I ahve attached the samples.

In this i have to put Downtime_Starttime and DOwntime_EndTime in front of matching STARTDate , EndDate and Event.

But using join it add another line instead.

Pla Help.

Thanks