How do I select distinct ID when ID could have multiple values

DWay

Aim: To find all properties where all ratings are not A to D

Issue: If a property has multiple ratings which are not A - D then these are still counted.

Code:

Select DISTINCT (PropertyID)
FROM TableA
WHERE Rating NOT BETWEEN 'A' AND 'D'
juergen d
Select PropertyID
FROM TableA
group by PropertyID
having sum(case when Rating IN ('A','B','C','D') then 1 else 0 end) = 0

If you want only the number of properties then put a count around that

select count(*) as property_count 
from
(
   select PropertyID from tableA ...
) alias_name

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How do I select distinct ID when ID could have multiple values

From Java

In SQL, how do I select unique user id when it may have two different observations?

From Dev

How do I delete a row when multiple rows have the same id

From Dev

How do I select rows distinct on test_id with max timestamp and result

From Dev

How to select an id through a class when you have multiple elements in the same page that have same class

From Dev

How can i have distinct selection from a list on the basis of id?

From Dev

How do I find all distinct values for each record (identified by ID) in BigQuery?

From Dev

SQL conditions - select ID who have multiple values in a column

From Dev

XPATH select distinct values ID and flag

From Dev

DIstinct values and id's on selection in select box

From Dev

How do I select distinct values between two dates

From Dev

How can I select lines with specific data when I have 2 lines with the same ID?

From Dev

How do I set select multiple values?

From Dev

How do i select row json with the id

From Dev

Select multiple values with same ID

From Dev

How do I click a button and have it remove two things without knowing their ID or class values?

From Dev

select distinct records where multiple rows exist for one ID based on values in another column

From Dev

How do you check if multiple select elements (*not* a multiselect) have values?

From Dev

How to select children of a div with a known ID when they have indeterminate IDs?

From Dev

How do i get values of id’s And also how do i merge multiple objects into single array into javascript

From Dev

How do I select multiple values in a DropDownList populated with enum values?

From Dev

How do I select only an image that's NOT inside a link when both are inside the same ID?

From Dev

How do I select only an image that's NOT inside a link when both are inside the same ID?

From Dev

PostgreSQL: SELECT DISTINCT vs SELECT DISTINCT ON (id)

From Dev

How do I register users if they have a valid id in the database?

From Dev

How can I select multiple button with same id in python selenium

From Dev

logstash output to elasticsearch with document_id; what to do when I don't have a document_id?

From Dev

Select elements by id using multiple values with jQuery

From Dev

How to select multiple distinct values and max values in postgres?

Related Related

  1. 1

    How do I select distinct ID when ID could have multiple values

  2. 2

    In SQL, how do I select unique user id when it may have two different observations?

  3. 3

    How do I delete a row when multiple rows have the same id

  4. 4

    How do I select rows distinct on test_id with max timestamp and result

  5. 5

    How to select an id through a class when you have multiple elements in the same page that have same class

  6. 6

    How can i have distinct selection from a list on the basis of id?

  7. 7

    How do I find all distinct values for each record (identified by ID) in BigQuery?

  8. 8

    SQL conditions - select ID who have multiple values in a column

  9. 9

    XPATH select distinct values ID and flag

  10. 10

    DIstinct values and id's on selection in select box

  11. 11

    How do I select distinct values between two dates

  12. 12

    How can I select lines with specific data when I have 2 lines with the same ID?

  13. 13

    How do I set select multiple values?

  14. 14

    How do i select row json with the id

  15. 15

    Select multiple values with same ID

  16. 16

    How do I click a button and have it remove two things without knowing their ID or class values?

  17. 17

    select distinct records where multiple rows exist for one ID based on values in another column

  18. 18

    How do you check if multiple select elements (*not* a multiselect) have values?

  19. 19

    How to select children of a div with a known ID when they have indeterminate IDs?

  20. 20

    How do i get values of id’s And also how do i merge multiple objects into single array into javascript

  21. 21

    How do I select multiple values in a DropDownList populated with enum values?

  22. 22

    How do I select only an image that's NOT inside a link when both are inside the same ID?

  23. 23

    How do I select only an image that's NOT inside a link when both are inside the same ID?

  24. 24

    PostgreSQL: SELECT DISTINCT vs SELECT DISTINCT ON (id)

  25. 25

    How do I register users if they have a valid id in the database?

  26. 26

    How can I select multiple button with same id in python selenium

  27. 27

    logstash output to elasticsearch with document_id; what to do when I don't have a document_id?

  28. 28

    Select elements by id using multiple values with jQuery

  29. 29

    How to select multiple distinct values and max values in postgres?

HotTag

Archive