Skip to content

Instantly share code, notes, and snippets.

@ranafaraz
Created March 1, 2021 07:24
Show Gist options
  • Save ranafaraz/bd3bf56329ecdf5fa413682215b6a155 to your computer and use it in GitHub Desktop.
Save ranafaraz/bd3bf56329ecdf5fa413682215b6a155 to your computer and use it in GitHub Desktop.
SELECT
l.value, -- Unique Identifier of Land
l.name, -- Name of the Land
l.description,
l.location,
(SELECT c.name FROM city c WHERE c.city_id = l.city_id) AS city,
l.longitude,
l.latitude,
l.dimentions,
(SELECT u.name FROM c_uom u WHERE u.c_uom_id = l.c_uom_id) AS uom,
l.historicalcost,
l.purchasecost,
(SELECT s.name FROM status s WHERE s.status_id = l.status_id) AS current_status,
(SELECT EXTRACT(YEAR FROM l.acquisitionyear)) AS acquisition_year,
(SELECT
mp.market_price
FROM
market_price mp
WHERE
mp.land_id = l.land_id
AND
mp.isactive = 'Y'
) AS Market_Price
FROM
Land l
WHERE
l.isactive = 'Y'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment