SQL Query用于查找连续行中的数字序列

时间:2014-11-11 22:57:25

标签: mysql sql-server

假设我有一个SQL表,其中一列的行中有一系列数字相互跟随,我想查找该序列是否出现在表中的其他位置。是否可以创建这样的查询?

表A

  1. 12.3
  2. 14.5
  3. 16.3
  4. 所以我需要找到这些数字在同一行序列中的其他位置并找到这些行。这在SQL中可行吗?我从Excel中提取文件,因为我无法在Excel中找到方法。

    谢谢大师:)

1 个答案:

答案 0 :(得分:0)

concat适用于sql-server

   1. concat these 3 number to a string
   2. concat next 3 numbers to a string
   3. compare these 2 strings
   4. if equel then you have it!

  do it in a loop