Skip to content

Commit

Permalink
Update field names
Browse files Browse the repository at this point in the history
I updated the name of the fields used in examples, changing the old ones by those listed in Database tables reference
  • Loading branch information
fppenna committed Oct 27, 2022
1 parent 1b2d48b commit 70936f6
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions docs/querying-data.rst
Expand Up @@ -99,19 +99,19 @@ The following query calculates the total value of tenders disaggregated by curre
.. code-block:: sql
SELECT
tender_value_currency, -- return the currency of the tender value, values in OCDS have an amount and a currency, as datasets may contain values in multiple currencies
tender_status,
sum(tender_value_amount)
value_currency, -- return the currency of the tender value, values in OCDS have an amount and a currency, as datasets may contain values in multiple currencies
status,
sum(value_amount)
FROM
tender_summary
WHERE
collection_id = 1259
GROUP BY
tender_value_currency,
tender_status
value_currency,
status
ORDER BY
tender_value_currency,
tender_status;
value_currency,
status;
To learn more about the summaries and aggregates in the ``tender_summary`` table, refer to the :ref:`tender_summary` documentation.

Expand Down Expand Up @@ -141,24 +141,24 @@ The following query calculates the top 10 buyers by award value for collection `
.. code-block:: sql
SELECT
buyer_identifier,
buyer_id,
buyer -> 'name' AS buyer_name, -- extract the buyer name from the JSON
award_value_currency,
sum(award_value_amount) AS award_amount
value_currency,
sum(value_amount) AS award_amount
FROM
awards_summary
JOIN
buyer_summary ON awards_summary.id = buyer_summary.id
WHERE
awards_summary.collection_id = 1259
AND
awards_summary.award_value_amount > 0 -- filter out awards with no value
awards_summary.value_amount > 0 -- filter out awards with no value
AND
awards_summary.award_status = 'active'
awards_summary.status = 'active'
GROUP BY
buyer_identifier,
buyer_id,
buyer_name,
award_value_currency
value_currency
ORDER BY
award_amount DESC
LIMIT 10;
Expand Down

0 comments on commit 70936f6

Please sign in to comment.