I'm trying to use the SQL statement below, to retrieve data from 3 tables. I get a syntax error near [aren1002] however.
select
holiday_notes.*,
HOLIDAY_REF.holiday_name as holiday_name from [aren1002].[HOLIDAY_NOTES]
left join [aren1002].[HOLIDAY_REF] on holiday_notes.holiday_id=HOLIDAY_REF.holiday_id
[aren1002].[lookup].lookup_desc as type_desc from [aren1002].[HOLIDAY_NOTES]
left join [aren1002].[lookup] on holiday_notes.[type]=lookup.lookup_id
where [HOLIDAY_NOTES].delete_date is null order by [HOLIDAY_NOTES].create_date desc
I'm trying to add the holiday_name column from HOLIDAY_REF and type_desc from the second table (lookup). I'm not totally sure how to structure the statement.