今天写的sql语句,可能以后用到几个

系统 1702 0
select * from sort
select top 10 * from v_companyusers where companyname like ' %杭州天下% '
create index adddateindex on v_companyusers(C_id desc )
create view V_CompanyUsers


select * from ssort where ss_id = 627
select * from companyinfo where c_id = ' 69958F6E '
as
select a. [ C_ID ] , [ CompanyName ] , [ GenderID ] , [ Introduce ] , [ LogoPath ] , [ CompanyPath ] , [ PurchaseProduct ] , [ MainProduct ] , [ DealType ] , [ CompanyType ] , [ Sort ] , [ SortOrder ] , [ regMoney ] , [ regTime ] , [ regPlace ] , [ CompanyAdderss ] , [ FoundTime ] , [ PPerson ] , [ PSex ] , [ PDept ] , [ PDuty ] , [ PAddress ] , [ PZip ] , [ PTel ] , [ PEmail ] , [ PPhone ] , [ PMobile ] , [ PFax ] , [ PQQ ] , [ PMSN ] , [ PWebSite ] , [ KeyWord ] , [ KeyStartTime ] , [ KeyEndTime ] , [ AddTime ] , [ Scores ] , [ Award ] , [ IsPass ] , [ PassTime ] , [ PassAdmin ] , [ OpenedMonth ] , [ IsPayment ] , [ IsPersonUpdate ] , [ PersonUpdateTime ] , [ IsCompanyUpdate ] , [ CompanyUpdateTime ] , [ IsContentUpdate ] , [ ContentUpdateTime ] , [ oldID1 ] , [ isdelete ] , [ U_Account ] , [ U_NickName ] , [ U_Sex ] , [ U_Password ] , [ U_Question ] , [ U_Answer ] , [ U_Note ] , [ U_Chk ] , [ U_AddTime ] , [ U_LoginNum ] , [ U_LastTime ] , [ FirstApplyDate ] , [ IsFirstPass ] , [ Reason ] , [ FirstPassDate ] , [ IsAdvancedApply ] from companyinfoa,userinfob where a.c_id = b.c_id

select * from [ zj123_b2b ] . [ dbo ] .sort where Column_name = ' 矿业设备 '

select * from b_company
select c_id,c_name,ss_id,ss_name,t.Column_id,t.column_Name from b_companya,ssortb,( select * from OPENROWSET ( ' SQLOLEDB ' , ' 127.0.0.1 ' ; ' sa ' ; '' , [ zj123_b2b ] . [ dbo ] .Sort))t where a.ssort = b.ss_id and t.column_name = b.ss_name

select distinct c_id,c_name,ss_id,ss_name,t.column_Name from b_companya,ssortb,( select * from OPENROWSET ( ' SQLOLEDB ' , ' 127.0.0.1 ' ; ' sa ' ; '' , [ zj123_b2b ] . [ dbo ] .Sort))t where a.ssort = b.ss_id and t.column_name = b.ss_name


select min (Column_id) from select min (Column_ID) from [ zj123_b2b ] . [ dbo ] .sort where group by Column_Name
-- deletefrom[zj123_b2b].[dbo].sortwhereColumn_IDnotin(selectdistinctParent_IDfrom[zj123_b2b].[dbo].sort)andColumn_IDnotin(selectmin(Column_ID)from(selectdistinct*from[zj123_b2b].[dbo].sortwhereColumn_IDnotin(selectdistinctParent_IDfrom[zj123_b2b].[dbo].sort))tgroupbyColumn_Name)

delete from ( select Column_ID from ( select distinct * from [ zj123_b2b ] . [ dbo ] .sort where Column_ID not in ( select distinct Parent_ID from [ zj123_b2b ] . [ dbo ] .sort))t group by Column_Name)t where t.Column_id not in ( select min (Column_ID) from ( select distinct * from [ zj123_b2b ] . [ dbo ] .sort where Column_ID not in ( select distinct Parent_ID from [ zj123_b2b ] . [ dbo ] .sort))t group by Column_Name)
其他未分类

delete from [ pubs ] . [ dbo ] .city


-- deletefrom[zj123_b2b].[dbo].sortwherecolumn_idin(selectcolumn_idfrom[zj123_b2b].[dbo].sortwhereColumn_idin(selectParent_idfrom(select*from[zj123_b2b].[dbo].sortwhereparent_id!='')t)andcolumn_depth=1)

select * from [ zj123_b2b ] . [ dbo ] .sort where column_name = ' 作业保护 '

select column_name, count ( * ) from [ zj123_b2b ] . [ dbo ] .sort where column_id in ( select distinct parent_id from [ zj123_b2b ] . [ dbo ] .sort) group by column_name

delete from [ zj123_b2b ] . [ dbo ] .sort where column_id = ' 66B072 '

update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5DD717 ' where column_id in ( select column_id from [ zj123_b2b ] . [ dbo ] .sort where parent_id = ' 00D5CC ' )

update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5D4160 ' where column_id in ( ' 56C0C7 ' )

select * from [ zj123_b2b ] . [ dbo ] .sort where parent_id = ' FE80CC '

select * from [ zj123_b2b ] . [ dbo ] .sort where column_id = ' 5E0EA9 '

select * from [ zj123_b2b ] . [ dbo ] .sort where column_name in ( select column_name from [ zj123_b2b ] . [ dbo ] .sort group by column_name having count ( * ) > 1 ) order by column_name desc


-- --------------------------------------------------------------------------------------------------

select min (Column_id), count ( * ),column_name from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 3 group by column_name having count ( * ) > 1

-- deletefrom[zj123_b2b].[dbo].sortwhereColumn_idin(selectmin(Column_id)from[zj123_b2b].[dbo].sortwherecolumn_depth=1groupbycolumn_name)

select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 1 order by column_name

-- ------------------------------
--
--第二步
select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 2 order by column_name

select min (Column_id), count ( * ),column_name from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 2 group by column_name having count ( * ) > 1

select * from [ zj123_b2b ] . [ dbo ] .sort where column_id = ' 0BAF08 '

-- ------------------------------
select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 1 order by column_name desc ,column_id

select max (Column_id),column_name, count ( * ) from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 1 group by column_name having count ( * ) >= 1

select * from [ zj123_b2b ] . [ dbo ] .sort where column_depth = 3 order by column_name where column_id = ' 0BAF08 '


-- -------------------------------------------------------------------------------/////////////////
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 0796CE ' where parent_id = ' 19E861 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 9671CF ' where parent_id = ' D4FD84 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5A6E06 ' where parent_id = ' 6073F5 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' AC3D13 ' where parent_id = ' DC5E01 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 74F0CB ' where parent_id = ' A61268 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 6103A9 ' where parent_id = ' 6C5C7E ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 4CC1DF ' where parent_id = ' F68730 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 6A726A ' where parent_id = ' 9CC1B5 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' C2DFDB ' where parent_id = ' D578E2 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 2A5475 ' where parent_id = ' C89C65 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 037721 ' where parent_id = ' E06107 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 8A62FE ' where parent_id = ' F256E9 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 70B5BD ' where parent_id = ' F24EC3 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 82F523 ' where parent_id = ' C591DE ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 72F93F ' where parent_id = ' 8A0552 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 5E0EA9 ' where parent_id = ' 19E861 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = ' 0796CE ' where parent_id = ' CEBE72 ' and column_depth = 2
update [ zj123_b2b ] . [ dbo ] .sort set parent_id = <
分享到:
评论

今天写的sql语句,可能以后用到几个


更多文章、技术交流、商务合作、联系博主

微信扫码或搜索:z360901061

微信扫一扫加我为好友

QQ号联系: 360901061

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描下面二维码支持博主2元、5元、10元、20元等您想捐的金额吧,狠狠点击下面给点支持吧,站长非常感激您!手机微信长按不能支付解决办法:请将微信支付二维码保存到相册,切换到微信,然后点击微信右上角扫一扫功能,选择支付二维码完成支付。

【本文对您有帮助就好】

您的支持是博主写作最大的动力,如果您喜欢我的文章,感觉我的文章对您有帮助,请用微信扫描上面二维码支持博主2元、5元、10元、自定义金额等您想捐的金额吧,站长会非常 感谢您的哦!!!

发表我的评论
最新评论 总共0条评论