COUNT(DISTINCT field) OVER (PARTITION BY another_field)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi list,

Does someone knows why this is not a supported feature?

I was happily SQL querying when I woke up from my dreams with this message:

ERROR:  DISTINCT is not implemented for window functions
LINE 6:  COUNT(DISTINCT handle) OVER (PARTITION BY pk_pessoas) AS ha...

It could be very useful to find unique references within groups of clone records. Or there is another way to write this kind of query?

Example (reference is a column of record_data):

SELECT
 group_key,
 record_data.*,
COUNT(DISTINCT reference) OVER (PARTITION BY group_key) AS unique_references
FROM record_data
ORDER BY
 group_key;

Regards,
--
Daniel Cristian Cruz
クルズ  クリスチアン ダニエル

[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux