Question: I am trying to extract rating from a tweet using regular expression. For example for below tweet, I want to get the user rating(9.75) and maximum rating(10). 

```
This is Logan, the Chow who lived. He solemnly swears he's up to lots of good. 9.75/10

```

I used below regex, but the capture groups 1 and 2 has results 75 and 10. I am not sure why the user rating is captured only after decimal group. 

```
.*(\d+\.?\d+)\/(\d*\.?\d*)

```

Answer: 
You can use aggregation and flter with a `having` clause:

```
select variant_id
from variant_parameter
where variant_id between 1 and 5 and parameter_id in (1, 2)
group by variant_id
having
    max(case when parameter_id = 2 and parameter_value = 'M' then 1 end) = 1
    and max(case when parameter_id = 1 and parameter_value = 'Black' then 1 end) = 1

```
You haven't provided an MCRE, so this just a guess...

```
SELECT variant_id 
  FROM variant_parameter 
 WHERE (parameter_id = 2 AND parameter_value IN ( 'M' ) )
    OR (parameter_id = 1 AND parameter_value IN ( 'Black' ))
GROUP BY variant_id
HAVING COUNT(*) = 2
 -- AND optional other condition

```