I'm trying to get 2 values from a knowledge base
%code, date, amount
values1('AAA', date(02, 03, 2020), 1000).
values1('AAA', date(31, 03, 2020), 2000).
values1('AAA', date(02, 04, 2020), 1350).
values1('BBB', date(15, 04, 2020), 1500).
values1('CCC', date(15, 05, 2020), 950).
I want to get the Code and Value by Month in two list. My idea was use findall two times, first to get the Code, and next to get Value, but it's not return the values, just Code.
function4(Month, Value, Code) :-
findall(Code, values1(Code, date(_, Month, _), _), Code),
findall(Value, values1(Code, _, Value), Value).
I'm newbie on prolog and any advice wuold be greatly appreciated.