Pergunta
SQL help please
I have a record set that brings up a list of industrial
Estates and checks with its estate reference in a table of
corresponding units for units that are available i.e. not let and
all works well.
My problem is some estates have more than one available unit and and therefore in my repeated region of the recordset I can have the same estate listed a few times over. I would like to show an estate in my repeated region only once even if it has a number of available units.
The code at the moment goes something like this:-
SELECT Region, Town, EstateName, Type, SizeSQFT, Estates.EstateReference
FROM Estates, Units
WHERE Region LIKE 'varRegion' AND Town LIKE 'varTown' AND EstateName LIKE 'varEstate' AND Type LIKE 'varType' AND SizeSQFT<= varSize AND Units.EstateReference = Estates.EstateReference AND Status ='Available'
ORDER BY Region, Town, EstateName
My problem is some estates have more than one available unit and and therefore in my repeated region of the recordset I can have the same estate listed a few times over. I would like to show an estate in my repeated region only once even if it has a number of available units.
The code at the moment goes something like this:-
SELECT Region, Town, EstateName, Type, SizeSQFT, Estates.EstateReference
FROM Estates, Units
WHERE Region LIKE 'varRegion' AND Town LIKE 'varTown' AND EstateName LIKE 'varEstate' AND Type LIKE 'varType' AND SizeSQFT<= varSize AND Units.EstateReference = Estates.EstateReference AND Status ='Available'
ORDER BY Region, Town, EstateName
