Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/26.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 server 要搜索的SQL查询_Sql Server_Database_Select - Fatal编程技术网

Sql server 要搜索的SQL查询

Sql server 要搜索的SQL查询,sql-server,database,select,Sql Server,Database,Select,我是sqlserver的新手,我刚刚开始学习它,我有一个问题。 **我想要一个SQL查询,它可以显示过去6个月内添加的所有行。在表“users”中,日期位于字段“joined”中,但其格式为UNIX时间戳格式 **然后,我想要像上面一样的另一个SQL查询,但它也与结果一起将每行中的字段“activate”设置为“yes” 我试过这个密码: select * from users where time_of_post is like '07/**/2011' **)但我不能正确地实施它 非常感谢

我是sqlserver的新手,我刚刚开始学习它,我有一个问题。 **我想要一个SQL查询,它可以显示过去6个月内添加的所有行。在表“users”中,日期位于字段“joined”中,但其格式为UNIX时间戳格式

**然后,我想要像上面一样的另一个SQL查询,但它也与结果一起将每行中的字段“activate”设置为“yes”

我试过这个密码:

select * from users where time_of_post is like '07/**/2011'
**)但我不能正确地实施它


非常感谢您事先提供的帮助。

然后第二个查询应该是:在用户激活值中插入“是”,其中选择*来自用户的日期diffmm、发布时间、getdate@R.Vector不太可能,听起来您只是想更新用户记录?请看我的编辑。如果这是您想要的,请告诉我。然后第二个查询应该是:在useractivation值中插入'yes',其中select*from users where datediffmm,time_of_post,getdate@R.Vector不,听起来您只是想更新用户记录?请看我的编辑。如果这是你想要的,请告诉我。
select *
from users
where datediff(mm, time_of_post, getdate()) <= 6
update users
set activation = 'yes'
where datediff(mm, time_of_post, getdate()) <= 6
and activation <> 'yes'