-3

I want to get duplicate data in the id_time_slot field with the value "7" ?

see the results of the request that I made

Barmar
  • 741,623
  • 53
  • 500
  • 612
  • 2
    Please post code and data as text, not images. – Nick Jan 03 '20 at 03:21
  • 2
    Your question isn't clear. Do you want a query that finds all the rows that have duplicate `id_time_slot`? – Barmar Jan 03 '20 at 03:31
  • If that's what you want, this is a duplicate of https://stackoverflow.com/questions/24738346/find-rows-with-duplicates-in-three-columns-without-specifying-value – Barmar Jan 03 '20 at 03:35

2 Answers2

0

Salam, try to add this:

Select * from // before your sql request

// all your sql request 

where id_slot_time = 7; // the end 

You will make a Select on your current result table ( a new table) that will give you what you want.

0

Use subquery GROUP BY schedule_number, id_slot_time HAING COUNT(*) > 1 to get the duplicated records

in group like this:

SELECT tb1.*
FROM (
  SELECT
    tb_schedule_detail.*
  FROM
    tb_schedule_detail
    JOIN tb_scheduler ON tb_scheduler.scheduler_number = tb_schedule_detail.scheduler_number
  WHERE 
    dock_id = 2
    AND tb_schedule_detail.rdd = '2020-01-02'
  GROUP BY tb_schedule_detail.schedule_number
) AS tb1 
GROUP BY tb1.schedule_number, tb1.id_slot_time
HAVING COUNT(*) > 1

TsaiKoga
  • 12,914
  • 2
  • 19
  • 28