select substr(code, 15) from table where to_date(substr(code, 7, 8), 'yyyymmdd') > 2002年8月1日 and to_date(substr(code, 7, 8), 'yyyymmdd') < 2002年8月31日 大概是这个意思,语法你自己调整一下.
select substr(产品代码,15,4) from yourtable where substr(产品代码,11,2)='08' and count(distinct(substr(产品代码,13,2)))=31
select 流水线编号 from tablename where to_number(substr(产品编号,13,2)) between 1 and 31;不知是不是这个意思
select substr(产品代码,15,4),count(distinct(substr(产品代码,13,2))) from yourtable where substr(产品代码,11,2)='08' group by substr(产品代码,15,4) 得出的结果为31的即为你要的流水线编号
或者是 select substr(产品代码,15,4) from yourtable where substr(产品代码,11,2)='08' group by substr(产品代码,15,4) having count(distinct(substr(产品代码,13,2)))=31 这样列出的就是结果了
你再把条件里加上2002年不就行了, select substr(产品代码,15,4) from yourtable where substr(产品代码,7,6)='200208' group by substr(产品代码,15,4) having count(distinct(substr(产品代码,13,2)))=31
大概是这个意思,语法你自己调整一下.
where substr(产品代码,11,2)='08'
and count(distinct(substr(产品代码,13,2)))=31
where substr(产品代码,11,2)='08'
group by substr(产品代码,15,4)
得出的结果为31的即为你要的流水线编号
select substr(产品代码,15,4) from yourtable
where substr(产品代码,11,2)='08'
group by substr(产品代码,15,4)
having count(distinct(substr(产品代码,13,2)))=31
这样列出的就是结果了
select substr(产品代码,15,4) from yourtable
where substr(产品代码,7,6)='200208'
group by substr(产品代码,15,4)
having count(distinct(substr(产品代码,13,2)))=31