“Cara Mendapatkan Tanggal Diff dari 2 Tanggal Di Lapangan Sama SQL Server” Kode Jawaban

Cara Mendapatkan Tanggal Diff Di Bidang Setelah di SQL Server

SELECT t1.OrderNo,DATEDIFF(day,t1.LoadedStartDate,t2.LoadedStartDate)
FROM UnnamedTableFromQuestion t1
       INNER JOIN
     UnnamedTableFromQuestion t2
       on
         t1.OrderNo = t2.OrderNo
WHERE t1.OpNo = 1 and
      t2.OpNo = 4
      
////////////////////////////////////////////////////////////////

select cur.unique_id_field, cur.seq_no, cur.date_created ,

  datediff(second, prv.date_created, cur.date_created) as diff_in_seconds

from yourtable as cur

  join yourtable as prv

    on cur.seq_no = prv.seq_no + 1;
Kandyman

Cara Mendapatkan Tanggal Diff dari 2 Tanggal Di Lapangan Sama SQL Server

WITH Partitioned AS(	SELECT *, ROW_NUMBER() OVER (PARTITION BY cu_id, date ORDER BY cu_id, date) AS RowNumber	FROM @Table) SELECT 	*,	CASE 		WHEN RowNumber > 1 THEN 0		ELSE COALESCE(DATEDIFF(DAY, (SELECT MAX(date) FROM @Table WHERE date < a.date AND cu_id = a.cu_id), a.date), 0)	END AS Days_betweenFROM Partitioned a
Kandyman

Jawaban yang mirip dengan “Cara Mendapatkan Tanggal Diff dari 2 Tanggal Di Lapangan Sama SQL Server”

Pertanyaan yang mirip dengan “Cara Mendapatkan Tanggal Diff dari 2 Tanggal Di Lapangan Sama SQL Server”

Lebih banyak jawaban terkait untuk “Cara Mendapatkan Tanggal Diff dari 2 Tanggal Di Lapangan Sama SQL Server” di Sql

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya