SQL语句求救啊

来源:百度知道 编辑:UC知道 时间:2024/05/29 12:49:46
我有一个表,里面的字段为,id,name,time,(注册时间),state(注册,签订,确认)
我想查到 从现在到注册时间过了6个月的 并且state=确认的 查到name

之后 再查有没name同相and state!='已确认',如果有话 把其状态改为state='失效';

救命啊!!!!!!!!!!!!!!!!

res=sta.executeQuery("select name from table where (now-time)>6 and state=确认") ;
String s=res.next().getString("name") ;

sta.executeUpdate("update table set state='失效' where name="+s+" and state!=确认") ;

没有经过调试 只是提供个思路 仅供参考 仅供参考 SQL语句对格式要求很严
这里只提供一个思路

给分的化,估计就有人答了~