I am trying to select data from same table twice and it works but it is not allowing me to use the first table in the list in INNER JOIN
, if I use the second table from the list in the join it works
So this is the query that works fine
SELECT
TOP 1
RIT_First.LastModified,
RIT_Last.LastModified
FROM
dbo.ItemTransaction RIT_First,
dbo.ItemTransaction RIT_Last
JOIN dbo.Item RI ON RIT_Last.ItemId = RI.Id -- Using the second table in the join
But when I do this
SELECT
TOP 1
RIT_First.LastModified,
RIT_Last.LastModified
FROM
dbo.ItemTransaction RIT_First,
dbo.ItemTransaction RIT_Last
JOIN dbo.Item RI ON RIT_First.ItemId = RI.Id -- Using the first table in the join
I start getting this error
The multi-part identifier "RIT_First.ItemId" could not be bound.
So is it like we can use only last table in the list of tables in the join or I am doing something wrong?