Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
4 grammar
source | link

Your query is close but doesn't work because no row will satisfy both text='wi-fi' AND text='bluetooth' at the same time.

You could use a self join instead:

SELECT
  pa1.*
FROM
  product_attribute pa1
  JOIN
  product_attribute pa2
  ON pa1.product_id = pa2.product_id
WHERE
  pa1.text = 'wi-fi'
  AND
  pa2.text = 'bluetooth'
;

That way the first version of the table (pa1) matches text='wi-fi', the second version(pa2) matches text='bluetooth', and the JOIN condition (pa1.product_id = pa2.product_id) assuresensures both conditions are met for a single product.

Your query is close but doesn't work because no row will satisfy both text='wi-fi' AND text='bluetooth' at the same time.

You could use a self join instead:

SELECT
  pa1.*
FROM
  product_attribute pa1
  JOIN
  product_attribute pa2
  ON pa1.product_id = pa2.product_id
WHERE
  pa1.text = 'wi-fi'
  AND
  pa2.text = 'bluetooth'
;

That way the first version of the table (pa1) matches text='wi-fi', the second version(pa2) matches text='bluetooth', and the JOIN condition (pa1.product_id = pa2.product_id) assures both conditions are met for a single product.

Your query is close but doesn't work because no row will satisfy both text='wi-fi' AND text='bluetooth' at the same time.

You could use a self join instead:

SELECT
  pa1.*
FROM
  product_attribute pa1
  JOIN
  product_attribute pa2
  ON pa1.product_id = pa2.product_id
WHERE
  pa1.text = 'wi-fi'
  AND
  pa2.text = 'bluetooth'
;

That way the first version of the table (pa1) matches text='wi-fi', the second version(pa2) matches text='bluetooth', and the JOIN condition (pa1.product_id = pa2.product_id) ensures both conditions are met for a single product.

3 grammar
source | link

Your query is close but doesn't work because haveno row will satisfy both text='wi-fi' AND text='bluetooth' at the same time.

You could use a self join instead:

SELECT
  pa1.*
FROM
  product_attribute pa1
  JOIN
  product_attribute pa2
  ON pa1.product_id = pa2.product_id
WHERE
  pa1.text = 'wi-fi'
  AND
  pa2.text = 'bluetooth'
;

That way the first version of the table (pa1) matches text='wi-fi', the second version(pa2) matches text='bluetooth', and the JOIN condition (pa1.product_id = pa2.product_id) assures both conditions are met for a single product.

Your query is close but doesn't work because have text='wi-fi' AND text='bluetooth' at the same time.

You could use a self join instead:

SELECT
  pa1.*
FROM
  product_attribute pa1
  JOIN
  product_attribute pa2
  ON pa1.product_id = pa2.product_id
WHERE
  pa1.text = 'wi-fi'
  AND
  pa2.text = 'bluetooth'
;

That way the first version of the table (pa1) matches text='wi-fi', the second version(pa2) matches text='bluetooth', and the JOIN condition (pa1.product_id = pa2.product_id) assures both conditions are met for a single product.

Your query is close but doesn't work because no row will satisfy both text='wi-fi' AND text='bluetooth' at the same time.

You could use a self join instead:

SELECT
  pa1.*
FROM
  product_attribute pa1
  JOIN
  product_attribute pa2
  ON pa1.product_id = pa2.product_id
WHERE
  pa1.text = 'wi-fi'
  AND
  pa2.text = 'bluetooth'
;

That way the first version of the table (pa1) matches text='wi-fi', the second version(pa2) matches text='bluetooth', and the JOIN condition (pa1.product_id = pa2.product_id) assures both conditions are met for a single product.

2 added explanation
source | link

Your query is close but doesn't work because have text='wi-fi' AND text='bluetooth' at the same time.

You could use a self join instead:

SELECT
  pa1.*
FROM
  product_attribute pa1
  JOIN
  product_attribute pa2
  ON pa1.product_id = pa2.product_id
WHERE
  pa1.text = 'wi-fi'
  AND
  pa2.text = 'bluetooth'
;

;That way the first version of the table (pa1) matches text='wi-fi', the second version(pa2) matches text='bluetooth', and the JOIN condition (pa1.product_id = pa2.product_id) assures both conditions are met for a single product.

Your query is close but doesn't work because have text='wi-fi' AND text='bluetooth' at the same time.

You could use a self join instead:

SELECT
  pa1.*
FROM
  product_attribute pa1
  JOIN
  product_attribute pa2
  ON pa1.product_id = pa2.product_id
WHERE
  pa1.text = 'wi-fi'
  AND
  pa2.text = 'bluetooth'

;

Your query is close but doesn't work because have text='wi-fi' AND text='bluetooth' at the same time.

You could use a self join instead:

SELECT
  pa1.*
FROM
  product_attribute pa1
  JOIN
  product_attribute pa2
  ON pa1.product_id = pa2.product_id
WHERE
  pa1.text = 'wi-fi'
  AND
  pa2.text = 'bluetooth'
;

That way the first version of the table (pa1) matches text='wi-fi', the second version(pa2) matches text='bluetooth', and the JOIN condition (pa1.product_id = pa2.product_id) assures both conditions are met for a single product.

1
source | link