C
C#4w ago
mrdudebro1

invalid column SQL

select inv_mast.item_id, sum(qty_on_hand) qty_on_hand, max(invoice_date) latest_invoice_date from inv_mast
join inv_loc on inv_loc.inv_mast_uid = inv_mast.inv_mast_uid
full join p21_sales_history_report_view on inv_mast.inv_mast_uid = p21_sales_history_report_view.inv_mast_uid
where qty_on_hand > 0 and location_id <> 40 and latest_invoice_date <= DATEADD(YEAR,-2,getdate())
group by inv_mast.item_id
select inv_mast.item_id, sum(qty_on_hand) qty_on_hand, max(invoice_date) latest_invoice_date from inv_mast
join inv_loc on inv_loc.inv_mast_uid = inv_mast.inv_mast_uid
full join p21_sales_history_report_view on inv_mast.inv_mast_uid = p21_sales_history_report_view.inv_mast_uid
where qty_on_hand > 0 and location_id <> 40 and latest_invoice_date <= DATEADD(YEAR,-2,getdate())
group by inv_mast.item_id
why is latest_invoice_date considered an invalid column here sql error Invalid column name 'latest_invoice_date'.
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server