-1

This is my table structure.

I want to compare the column property_id by the column label_id.

Table: label_master

id label_id property_id property_value
1 1 1 10
2 1 2 15
3 2 1 20
4 2 2 25
5 3 1 5
6 3 2 10

I want to apply the condition like

where (property_id = 1 and property_value >= 10) and (property_id = 2 and property_value >= 15)

I want to check both property_id's property_value of same label.

My expected out is

id label_id property_id property_value
1 1 1 10
2 1 2 15
3 2 1 20
4 2 2 25
Dhruv Raval
  • 1,535
  • 1
  • 8
  • 15

1 Answers1

2

You want or in your logic:

where (property_id = 1 and property_value >= 10) or
      (property_id = 2 and property_value >= 15)
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786