Hello,
I have 2 tables as below with the data loaded as below, I need a query to join 2 tables on id whenever the charge is -ve values, there should not be any duplicate values
ex:id 20 has 2 transactions each with charge -1:00 since the charge is -ve we should not see duplicate values in the joined query for id 20.
Please help me with the query
create table a1
(
id int,
name string
)
row format delimited fields terminated by ","
stored as textfile
create table b1
(
id int,
charge float
)
row format delimited fields terminated by ","
stored as textfile
INSERT INTO a1 values
(10, "sant"),
(20, "suvi"),
(25, "kal"),
(26, "deep"),
(27, "satya"),
(30, "manju")
INSERT INTO b1 values
(10, 1.00),
(20, -1.00),
(25, 1.00),
(26, -1.00),
(27, 1.00),
(28, -1.00),
(20, -1.00),
(26, -1.00),
(28, -1.00),
(10, 2.00)