Skip to main content
Announcements
See why Qlik is a Leader in the 2024 Gartner® Magic Quadrant™ for Analytics & BI Platforms. Download Now
cancel
Showing results for 
Search instead for 
Did you mean: 
suzzymay
Contributor
Contributor

joining tables

I have 2 sets of tables which i want to join, but i would like to keep only the maximum leased value out of the two records.

can this be done with a join ?

Date,scope,total,leased

1568683617,60.225.128.0/17,32765,200
1568683617,101.173.0.0/18,16381,16381
1568683617,124.180.64.0/20,4093,4093
1568683617,124.180.112.0/20,4093,0
1568683617,124.180.176.0/20,4093,0
1568683617,124.182.96.0/19,8189,0
1568683617,124.182.208.0/21,2045,2045
1568683617,124.182.224.0/19,8189,8189

1568684617,60.225.128.0/17,32765,205
1568684617,101.173.0.0/18,16381,0
1568684617,124.180.64.0/20,4093,100
1568684617,124.180.112.0/20,4093,4093
1568684617,124.180.176.0/20,4093,4093
1568684617,124.182.96.0/19,8189,8189
1568684617,124.182.208.0/21,2045,0
1568684617,124.182.224.0/19,8189,0

 

Would like to end up with

1568684617,60.225.128.0/17,32765,205
1568683617,101.173.0.0/18,16381,16381
1568683617,124.180.64.0/20,4093,4093
1568684617,124.180.112.0/20,4093,4093
1568684617,124.180.176.0/20,4093,4093
1568684617,124.182.96.0/19,8189,8189
1568683617,124.182.208.0/21,2045,2045
1568683617,124.182.224.0/19,8189,8189

3 Replies
StarinieriG
Partner - Specialist
Partner - Specialist

Hi,

 

you could try in this way:

1) concatenate the 2nd table (this table will be called TEST in the example)

2) then do something like this:

NoConcatenate
TABLE:
LOAD
scope,
total,
Max(leased) AS leased
Resident TEST
Group By
scope,
total
;

Left Join
LOAD
Date,
scope,
total,
leased
Resident TEST;

 

Drop table TEST;

miskinmaz
Creator III
Creator III

Brett_Bleess
Former Employee
Former Employee

Suzanne, did either of the posts work for you?  If one or both did, be sure to give the poster credit and let others know which one worked by using the Accept as Solution button on the appropriate post.  If you did something different, consider leaving a post on what you did and then mark that post as the solution.  If you are still working on things, leave an update.

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.