sql >> Database >  >> RDS >> Oracle

Converteer keep density_rank van Oracle-query naar postgre

U kunt PostgreSQL WINDOW FUNCTIONS . gebruiken

-- we only added infos to the activity_monitor_transaction
-- we are free to group by date_time or status
SELECT
  first_value(status) OVER w AS global_transaction_status,
  count(*) OVER w AS global_transaction_count,
  activity_monitor_transaction.*
FROM
  activity_monitor_transaction
WINDOW w AS (
  PARTITION BY global_transaction_id
  ORDER BY date_time DESC, id DESC
  ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING
)



  1. '0000-00-00' blokkeren van MySQL-datumvelden

  2. PostgreSQL 11 upgraden naar PostgreSQL 12 zonder downtime

  3. Dubbel gecodeerde UTF8-tekens repareren (in een utf-8-tabel)

  4. Transformeer/projecteer een geometrie van de ene SRID naar de andere