I have a number of items that are for rent in an item table. I have a transnational table that shows the rental history on each item in my item table. If the item is currently not being rented then all entries in the "Availability Status" column will say 'closed'. If the item is being rented one of the fields in the "Availability Status" column will say "ONRENT". I want to write a query that will list each rental item and return whether they are currently "ONRENT" (Not Available) or "CLOSED" (Available). I have written a query that returns rental items that are "ONRENT" since my WHERE clause can find the only row containing "ONRENT". Not sure how to return available items when all the rows in the "Availability Status" column say "CLOSED" Here is my successful query for ONRENT items.
select rl.[No_],
rl.[Manufacturer Code],
rl.[Model Code],
rl.[Availability Status],
rl.[Start Date],
rh.[Order Date],
rh.[No_],
rh.[Ship-to Name],
rh.[Ship-to Address]
from [LIVE$Rental Line]rl left outer join [LIVE$Rental Header]rh
on rl.[Document No_] = rh.[No_]
where rl.[Availability Status] = 'ONRENT'
and rl.[No_] not like 'SR%'