Basic SQL: Add column to select statement (ie value from another table)
Basic SQL: Add column to select statement (ie value from another table)
(OP)
Hi there,
I need to add a 4th column to my current select statement on LedgerTransactions. This fourth column is the company name which is obtained from (select CoName FROM LedgerParameters). There are no shared columns between these two tables for me to do a join. For a better explanation, please see my screenshot attached.
Could somebody please help me write a single SQL statement to result in my four-column table?

Thank you in advance,
Michelle
I need to add a 4th column to my current select statement on LedgerTransactions. This fourth column is the company name which is obtained from (select CoName FROM LedgerParameters). There are no shared columns between these two tables for me to do a join. For a better explanation, please see my screenshot attached.
Could somebody please help me write a single SQL statement to result in my four-column table?

Thank you in advance,
Michelle
RE: Basic SQL: Add column to select statement (ie value from another table)
SELECT AutoNumber,DDAte,Amount*(-1) as Amount, (select CoName from LedgerParameters) as Company
FROM LedgerTransactions LT
WHERE DDATE >= DATEFROMPARTS(2019,01,01)
AND LT.AccNumber IN
(select distinct AccNumber FROM LedgerMaster)
ORDER BY ddate DESC