<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>邻家小院- - SQL语句</title>
    <link>http://91baohe.com/forum.php?mod=forumdisplay&amp;fid=4</link>
    <description>Latest 20 threads of SQL语句</description>
    <copyright>Copyright(C) 邻家小院-</copyright>
    <generator>Discuz! Board by Comsenz Inc.</generator>
    <lastBuildDate>Tue, 26 May 2026 20:29:00 +0000</lastBuildDate>
    <ttl>60</ttl>
    <image>
      <url>http://91baohe.com/static/image/common/logo_88_31.gif</url>
      <title>邻家小院-</title>
      <link>http://91baohe.com/</link>
    </image>
    <item>
      <title>开屏1.0 2.0批量替换店号SQL</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=386</link>
      <description><![CDATA[-- 1. 更新 记录绑定 表
UPDATE [lj_kp].[dbo].[记录绑定]
SET 范围组ID = 115
WHERE 
    设备ID IN (
\'10948\',\'10272\',\'10935\',\'10339\',\'11303\',\'10410\',\'11365\',\'10569\',\'100322\',\'10110019\',
\'10110016\',\'70725\',\'11166\',\'10832\',\'11076\',\'10963\',]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Thu, 02 Apr 2026 00:48:26 +0000</pubDate>
    </item>
    <item>
      <title>SQL SERVER将已有的分组复制一份到新分组</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=376</link>
      <description><![CDATA[INSERT INTO [lj_dzsw].[dbo].[黑名单] (商品名, 分组, 修改时间)
SELECT 
    t.商品名,        -- 引用外层别名t的商品名字段
    \'淮南市烟草\',    -- 分组替换为「淮南市烟草」
    t.修改时间       -- 保留原修改时间
FROM [lj_dzsw].[dbo].[黑名单] AS t  -- 外 ...]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Mon, 09 Feb 2026 01:52:15 +0000</pubDate>
    </item>
    <item>
      <title>更新工号加09</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=372</link>
      <description><![CDATA[UPDATE LOTTERYREDEEM 
SET FIELD1 = storecode || \'09\'   
WHERE FIELD1 = \'09\';]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Wed, 21 Jan 2026 07:48:32 +0000</pubDate>
    </item>
    <item>
      <title>SQL 2012</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=309</link>
      <description><![CDATA[USE Lj_AI;
GO




CREATE TABLE Lj_AI_Category (
    CategoryID INT PRIMARY KEY IDENTITY(1,1),
    CategoryName NVARCHAR(100) NOT NULL UNIQUE,
    ParentCategoryID INT NULL,
    CreateTime DATETIME DEFAULT GETDATE(),
    Description NVARCHAR(500]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Tue, 20 May 2025 15:14:32 +0000</pubDate>
    </item>
    <item>
      <title>orcale把重复的业务并且未处理的标记</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=307</link>
      <description><![CDATA[UPDATE LJBUSAMOUNT la
SET la.STATE = \'作废状态\'
WHERE la.STATE IS NULL
  AND EXISTS (
    SELECT 1
    FROM LJACCOUNT ac 
    WHERE TRIM(la.STOREID) = TRIM(ac.ACCOUNTID)
      AND ac.ORGTYPE = 2
  )

  AND la.SETTLEDATE &gt;= \'2025/05/05\'
  AND RO]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Fri, 16 May 2025 08:21:00 +0000</pubDate>
    </item>
    <item>
      <title>H6贸易协议,到期前7天提醒</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=304</link>
      <description><![CDATA[SELECT 
    a.BEGINDATE,
    a.ENDDATE,
    b.CODE,
    b.NAME,
    NVL(h.CTRBP2, \'\') AS CTRBP2 
FROM (
    SELECT 
        v.*, 
        ROW_NUMBER() OVER (PARTITION BY v.NUM ORDER BY v.ENDDATE DESC) AS rn
    FROM HD40.VDRAGMTDTLINV v
    W]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Wed, 07 May 2025 03:35:41 +0000</pubDate>
    </item>
    <item>
      <title>供应商不足7天显示</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=303</link>
      <description><![CDATA[select CODE,NAME,CNTRBGNDATE,CNTRENDDATE,VDRSTAT,CONTACTOR,CTRBP2 from HD40.VENDORH t where VDRSTAT=\'已合作\' AND CNTRENDDATE - SYSDATE &lt; 7   AND CNTRENDDATE &gt;= SYSDATE]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Mon, 05 May 2025 01:37:19 +0000</pubDate>
    </item>
    <item>
      <title>SQL SERVER2012 右连接</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=300</link>
      <description><![CDATA[SELECT 
    s.[ID],
    s.[store],
    s.[store_name],
    s.[conn],
    s.[equipmentNo],
    s.[timestamp],
    s.[note],
    s.[region],
    c.[shopNo]
FROM 
    [lj_tc].[dbo].[STORE_TERM_STORE] s
LEFT JOIN 
    [lj_tc].[dbo].[STORE_TERM_CO]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Thu, 24 Apr 2025 06:27:20 +0000</pubDate>
    </item>
    <item>
      <title>SQL Server 排它锁 行锁</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=292</link>
      <description><![CDATA[集_连接池.开始事务 ()

局_SQL ＝ “select *  FROM ORDERS  WITH (XLOCK, ROWLOCK) where order_id=\'123\'”
局_记录集.导入 (集_连接池.取记录集 (局_SQL, , ))
输出调试文本 (删首尾空 (局_记录集.读记录 (“order_id”).取文本 ()))
集_连接池.保存事务 ()
局_记录 ...]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Sun, 06 Apr 2025 11:35:29 +0000</pubDate>
    </item>
    <item>
      <title>ORCALE  增加字段 可空默认为0</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=290</link>
      <description><![CDATA[ALTER TABLE HD40.LJ_PAYMENTMADE_new
ADD ET NUMBER DEFAULT 0 NULL;]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Wed, 02 Apr 2025 02:59:10 +0000</pubDate>
    </item>
    <item>
      <title>SQL添加唯一索引</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=279</link>
      <description><![CDATA[-- 添加唯一约束
ALTER TABLE LJACCOUNT_MD 
ADD CONSTRAINT uk_user_id_no UNIQUE (USER_ID_NO);

-- 删除重复数据（保留一条）或查
DELETE FROM LJACCOUNT_MD
WHERE ROWID NOT IN (
    SELECT MIN(ROWID)
    FROM LJACCOUNT_MD
    GROUP BY USER_ID_NO
    HAVING  ...]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Sat, 15 Mar 2025 03:59:26 +0000</pubDate>
    </item>
    <item>
      <title>分页加排序</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=227</link>
      <description><![CDATA[select ROWNUM RN,KK.*from 

 (
 select  PAY_ACCNO as 帐号, PAY_ACCNAME  as 户名 , TRANS_AMT as 交易金额, CUR_AMT as  当前余额, 
decode(TRANS_TP,  \'01\',\'转账入金\',  \'02\',\'退汇\',  \'03\',\'支付渠道入金\',  \'04\',\'提现\',  \'05\',\'退款-(预留)\',  \'06\',\'其它\')   ...]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Sun, 06 Oct 2024 01:00:30 +0000</pubDate>
    </item>
    <item>
      <title>ORCALE备份表</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=221</link>
      <description><![CDATA[create table ljaccount_20230419 as select * from ljaccount]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Tue, 30 Jul 2024 00:51:47 +0000</pubDate>
    </item>
    <item>
      <title>orcale文本连接符号</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=220</link>
      <description><![CDATA[select *from LJACCOUNT where storeid=\'80210073\'||\'B\' for update]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Mon, 29 Jul 2024 02:42:10 +0000</pubDate>
    </item>
    <item>
      <title>oracle 查询某列有重复的值</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=219</link>
      <description><![CDATA[SELECT user_id, COUNT(*)
FROM LJACCOUNT
GROUP BY user_id
HAVING COUNT(*) &gt; 1;

查询  LJACCOUNT  中user_id 有重复的]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Fri, 26 Jul 2024 00:32:22 +0000</pubDate>
    </item>
    <item>
      <title>SQL 嵌套查询</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=189</link>
      <description><![CDATA[SELECT *FROM LJACCOUNT where user_id= (select USER_ID  from LJACCOUNT where storeid=\'11026B\' )]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Tue, 11 Jun 2024 09:42:45 +0000</pubDate>
    </item>
    <item>
      <title>orcale取文本长度LENGTH</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=147</link>
      <description><![CDATA[select * from LOTTERYREDEEM WHERE FIELD4=\'修正\' and LENGTH(storecode)=8  for update]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Wed, 27 Mar 2024 00:30:32 +0000</pubDate>
    </item>
    <item>
      <title>体彩兑奖修正未获取工号</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=146</link>
      <description><![CDATA[update LOTTERYREDEEM set FIELD4=\'修正\' FIELD1=  to_char(TO_CHAR(storecode) ||  TO_CHAR(\'09\')) 
 where   FIELD3 IS NOT NULL AND FIELD1 IS NULL]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Mon, 25 Mar 2024 02:57:23 +0000</pubDate>
    </item>
    <item>
      <title>orcale分页查询</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=143</link>
      <description><![CDATA[select *from (


select t.*,ROWNUM RN  from LJACCOUNT t

)   where RN between  19 and 21]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Tue, 12 Mar 2024 02:47:01 +0000</pubDate>
    </item>
    <item>
      <title>oracle增加表字段</title>
      <link>http://91baohe.com/forum.php?mod=viewthread&amp;tid=136</link>
      <description><![CDATA[alter Table LJACCOUNT  
add （TEMPGS varchar(40) default \'\'，
MARKUP NUMBER(24,4) Default 0）]]></description>
      <category>SQL语句</category>
      <author>admin</author>
      <pubDate>Wed, 17 Jan 2024 00:29:40 +0000</pubDate>
    </item>
  </channel>
</rss>