SELECT * INTO docimagefilebak2 FROM (select * from docimagefile where operatedate = '2023-07-07')有什么问题
时间: 2024-04-08 18:30:38 浏览: 17
在您提供的SQL查询中,子查询的括号位置不正确。应该将子查询放在FROM子句之后。正确的查询应该是这样的:
```sql
SELECT *
INTO docimagefilebak2
FROM (
SELECT *
FROM docimagefile
WHERE operatedate = '2023-07-07'
) AS subquery;
```
这样,子查询将作为一个临时表,从中选择的数据将被插入到新的表`docimagefilebak2`中。请注意使用`AS subquery`为子查询创建别名。
相关问题
data.forEach((i,index)=>{ i.operatedate=i.operatedate.substring(0,10) let iconHtml = ''; if(i.operatedate === '2023-05-24'){ iconHtml = '<i class="glyphicon glyphicon-star-empty"></i>'; } $(".bottombingo").append(` <div class="bingodiv" style="margin-bottom:10px;" onclick="verxxggfb_id('\${i.id}')"> <div style="font-size:14px;font-weight:bolder;white-space:nowrap;overflow:hidden;">\${i.title} \${iconHtml}</div> <div style="font-size:12px;color:#3e3e3e;">\${i.operatedate}</div> </div>`) if(index == data.length-1){ //内部内容总高度 var height1 = $(".bottombingo").height(); var height2 = $(".bottombingo").parents('.card-table').height(); if(height1>height2){ //超出原本高度去进行上下走马灯 // setInterval(timerxxts,3000); var timer; // 定时器变量 // 启动定时器 timer = setInterval(timerxxts, 3000); // 鼠标进入 .bottombingo 时清除定时器 $(".bottombingo").on("mouseenter", function() { clearInterval(timer); }); // 鼠标离开 .bottombingo 时重新启动定时器 $(".bottombingo").on("mouseleave", function() { timer = setInterval(timerxxts, 3000); }); } } })修改这段代码使i.operatedate等于近三天的日期后iconHtml才有值
可以将第5行的日期判断条件改为:
```
if (new Date(i.operatedate) >= new Date(new Date().getTime() - 3 * 24 * 60 * 60 * 1000)) {
iconHtml = '<i class="glyphicon glyphicon-star-empty"></i>';
}
```
这样就可以判断i.operatedate是否在三天内了。具体代码如下:
```
data.forEach((i, index) => {
i.operatedate = i.operatedate.substring(0, 10);
let iconHtml = '';
if (new Date(i.operatedate) >= new Date(new Date().getTime() - 3 * 24 * 60 * 60 * 1000)) {
iconHtml = '<i class="glyphicon glyphicon-star-empty"></i>';
}
$(".bottombingo").append(`
<div class="bingodiv" style="margin-bottom:10px;" onclick="verxxggfb_id('${i.id}')">
<div style="font-size:14px;font-weight:bolder;white-space:nowrap;overflow:hidden;">${i.title} ${iconHtml}</div>
<div style="font-size:12px;color:#3e3e3e;">${i.operatedate}</div>
</div>`)
if (index == data.length - 1) {
//内部内容总高度
var height1 = $(".bottombingo").height();
var height2 = $(".bottombingo").parents('.card-table').height();
if (height1 > height2) {
//超出原本高度去进行上下走马灯 // setInterval(timerxxts,3000);
var timer; // 定时器变量
// 启动定时器
timer = setInterval(timerxxts, 3000);
// 鼠标进入 .bottombingo 时清除定时器
$(".bottombingo").on("mouseenter", function() {
clearInterval(timer);
});
// 鼠标离开 .bottombingo 时重新启动定时器
$(".bottombingo").on("mouseleave", function() {
timer = setInterval(timerxxts, 3000);
});
}
}
});
```
data.forEach((i,index)=>{ $(".bottombingo").append(` <div class="bingodiv" style="margin-bottom:10px;" onclick="verxxggfb_id('\${i.id}')"> <div style="font-size:14px;font-weight:bolder;white-space:nowrap;overflow:hidden;">\${i.title}</div> <div style="font-size:12px;color:#3e3e3e;">\${i.operatedate}</div> </div>`) if(index == data.length-1){ //内部内容总高度 var height1 = $(".bottombingo").height(); var height2 = $(".bottombingo").parents('.card-table').height(); if(height1>height2){ //超出原本高度去进行上下走马灯 // setInterval(timerxxts,3000); var timer; // 定时器变量 // 启动定时器 timer = setInterval(timerxxts, 3000); // 鼠标进入 .bottombingo 时清除定时器 $(".bottombingo").on("mouseenter", function() { clearInterval(timer); }); // 鼠标离开 .bottombingo 时重新启动定时器 $(".bottombingo").on("mouseleave", function() { timer = setInterval(timerxxts, 3000); }); } } })修改这段代码,当i.time等于2023-05-24时,给bingodiv后边添加新的图标
可以在模板字符串中添加一个判断条件,如果当前遍历到的数据的operatedate等于"2023-05-24",则在bingodiv的结尾处添加一个新的图标。修改后的代码如下:
```
data.forEach((i,index)=>{
var iconHTML = ""; // 定义图标的HTML代码
if(i.operatedate === "2023-05-24"){
iconHTML = '<img src="icon.png" style="width:20px;height:20px;margin-left:5px;">';
}
$(".bottombingo").append(`
<div class="bingodiv" style="margin-bottom:10px;" onclick="verxxggfb_id('${i.id}')">
<div style="font-size:14px;font-weight:bolder;white-space:nowrap;overflow:hidden;">${i.title}</div>
<div style="font-size:12px;color:#3e3e3e;">${i.operatedate}${iconHTML}</div>
</div>
`);
if(index == data.length-1){
var height1 = $(".bottombingo").height();
var height2 = $(".bottombingo").parents('.card-table').height();
if(height1>height2){
setInterval(timerxxts,3000);
var timer;
timer = setInterval(timerxxts, 3000);
$(".bottombingo").on("mouseenter", function() {
clearInterval(timer);
});
$(".bottombingo").on("mouseleave", function() {
timer = setInterval(timerxxts, 3000);
});
}
}
});
```
其中,定义了一个iconHTML变量,通过判断i.operatedate是否等于"2023-05-24"来确定是否添加一个新的图标。如果需要修改图标的样式,可以调整iconHTML中的HTML代码。
相关推荐
![doc](https://img-home.csdnimg.cn/images/20210720083327.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)