Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/71.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 从链接中提取数据并将其放置在新列中_Sql_Oracle - Fatal编程技术网

Sql 从链接中提取数据并将其放置在新列中

Sql 从链接中提取数据并将其放置在新列中,sql,oracle,Sql,Oracle,我有几个链接: Column1 Column2 --------------- <a href=" https://link; m=date1>Link</a> date1 <a href=" https://link; m=date2>Link</a> date2 <a href="

我有几个链接:

    Column1                                    Column2           
    ---------------
   <a href=" https://link; m=date1>Link</a>     date1        
   <a href=" https://link; m=date2>Link</a>     date2
   <a href=" https://link; m=date3>Link</a>     date3
Column1 Column2
---------------
日期1
日期2
日期3
结果列应如下所示:

    Column1                                    Column2       Column3     
    ---------------
   <a href=" https://link; m=date1>Link</a>     date1         date1  
   <a href=" https://link; m=date2>Link</a>     date2         date2
   <a href=" https://link; m=date3>Link</a>     date3         date3
Column1 Column2 Column3
---------------
日期1日期1
日期2日期2
日期3日期3
我想从链接(date1、date2、date3)中提取,添加到第3列的值与第2列中的值一致

我不知道应该使用什么查询?

您可以使用:

select col1, col2, case when regexp_like(col1,col2) then col2 end as col3  
  from t 
只需检查col1中存在col2列的值,并生成col3


修复表格格式,以便我们了解每列的数据。并详细说明预期结果。我同意jarlh的观点。您有三个列标题,但我只能识别两个不同的列。有关如何创建美观的表格的一些提示,请参见。另外:您的问题中是指
date1
而不是
data2
?好的,我编辑了这个,现在应该看起来更好了提取它们需要什么条件,为什么要复用相同的数据。。?如果
column1
中存在
column2
的值,则更好的方法可能是生成
1
,否则
0
作为
column3
的值。看起来您只需要一份column2?谢谢BarbarosÖzhan:D