I’ve been trying to code a self join for my Db and I get SYNTAX ERROR all the time.
I have a Table of stocks
stock -> stock name
trade -> short or long
time -> end time of trade
p_L-> profit / loss of trade
I want to code a self join query to sum (or count in another query) separately rofits and losses of all trades.
I other words : the sum ( or number of successful trades separately, and the sum ( or number of failedtrades separately.
SELECT P.p_l AS AS plus, L.p_l AS minus FROM stocks WHERE p.P_l>=0 and l.P_l<0 having TYPE = fb ORDER BY o_time
what is wrong here? I can’t even get a list of the trades