我有如下表:
ID ref num type time stamp
------------------------------
1 456 X Time 1
2 456 Y updated Timestamp
3 678 X Time 3
4 678 Y updated timestamp
我需要帮助来构建一个查询,该查询将为我提供如下结果:
ref num Type Time difference
------------------------------------
456 X (Timestamp diff between Type X and Type Y for a ref num)
678 Y (Timestamp diff between Type X and Type Y for a ref num)