0

I'm attempting to adapt the following query so that in Concats the results without any duplicates.

SELECT `increment_id`
FROM `sales_order`
WHERE `remote_ip`
LIKE '123.123.123.123'

Based on this post, I have adapted the query to the following:

SELECT `remote_ip`, GROUP_CONCAT(DISTINCT `increment_id` SEPARATOR ', ')
FROM `sales_order`
GROUP BY `remote_ip`

However, I'm struggling to find a place to add LIKE '123.123.123.123' without causing an error.

Flimzy
  • 68,325
  • 15
  • 126
  • 165
Craig
  • 135
  • 1
  • 2
  • 12

1 Answers1

1

You simply need to add the WHERE condition after your FROM clause, to filter the data accordingly:

SELECT `remote_ip`, GROUP_CONCAT(DISTINCT `increment_id` SEPARATOR ', ')
FROM `sales_order`
WHERE `remote_ip` LIKE '123.123.123.123'
GROUP BY `remote_ip`
Madhur Bhaiya
  • 27,326
  • 10
  • 44
  • 54