




















Load B
Load A
Create B
Create A
歡迎大家留言發散討論
posted @ 2009-09-26 18:38 Robert Su 閱讀(630) | 評論 (1) | 編輯 收藏
Load B
Load A
Create B
Create A
歡迎大家留言發散討論
posted @ 2009-09-26 18:38 Robert Su 閱讀(630) | 評論 (1) | 編輯 收藏
posted @ 2009-09-07 17:03 Robert Su 閱讀(809) | 評論 (1) | 編輯 收藏
posted @ 2009-09-07 11:28 Robert Su 閱讀(3250) | 評論 (0) | 編輯 收藏
posted @ 2009-09-01 18:18 Robert Su 閱讀(1484) | 評論 (0) | 編輯 收藏
把 WordPress 作為 CMS 來使用在2.1版本變得更加容易,只需5個簡單的步驟并且不需去修改復雜的代碼就能實現。
當為你的 CMS 創建頁面的時候,確定頁面順序必須在0和99之間。這樣的話,菜單中的第一個就是 home,最后的是 weblog,當然你可以根據你自己的需求更改。
posted @ 2009-08-26 22:22 Robert Su 閱讀(143) | 評論 (0) | 編輯 收藏
建設中
您想要查看的站點當前沒有默認頁。可能正在對它進行升級和配置操作。
請稍后再訪問此站點。如果您仍然遇到問題,請與網站的管理員聯系。
如果您是網站的管理員,并且認為您是由于錯誤才收到此消息,請參閱 IIS 幫助中的"啟用和禁用動態內容"。
posted @ 2009-08-25 23:16 Robert Su 閱讀(188) | 評論 (0) | 編輯 收藏
posted @ 2009-08-17 09:05 Robert Su 閱讀(300) | 評論 (0) | 編輯 收藏
posted @ 2009-08-16 11:14 Robert Su 閱讀(664) | 評論 (0) | 編輯 收藏
posted @ 2009-08-06 10:28 Robert Su 閱讀(354) | 評論 (0) | 編輯 收藏
7.5.2
程序代碼
Update (ctarticle AS a LEFT JOIN ctclass AS c ON a.classid = c.classid) LEFT JOIN cttag AS b ON a.articleid = b.articleid
SET tag=tag+' ', b.articleid=a.articleid, b.classid=a.classid, b.nclassid=a.nclassid
Where a.classid=23 AND a.nclassid=0 AND tagid is not null
7.5.1
程序代碼
Update (ctarticle AS a LEFT JOIN (ctnclass AS c LEFT JOIN
ctclass AS d ON c.classid = d.classid) ON a.nclassid = c.nclassid AND
a.classid = c.classid) LEFT JOIN cttag AS b ON a.articleid =
b.articleid SET tag=d.class+' '+c.nclass, b.articleid=a.articleid,
b.classid=a.classid, b.nclassid=a.nclassid Where a.classid=23 AND
a.nclassid=197;
7.5 更新操作
74.5 左連接中數據的篩選
程序代碼
Insert INTO cttag(articleid,classid,nclassid) Select
a.articleid,a.classid,a.nclassid from ctarticle a left join cttag b on
a.articleid=b.articleid where b.articleid is null
//本語句功能為, 顯示主表的全部內容, 插入數據到副表中沒有的數據
//主要作用為: 讓數據減少冗余
7.4.4.1 上例中的延續
程序代碼
Select a.*, b.*, c.*, d.*
FROM cttag as d left join
((ctarticle AS a LEFT JOIN ctclass AS b ON a.classid=b.classid) LEFT
JOIN ctnclass AS c ON a.nclassid=c.nclassid) on d.articleid=a.articleid;
7.4.4 顯示文章表中的全部, 調用類別表中的欄目
程序代碼
select a.*, b.*, c.* from (ctarticle a left join ctclass b on a.classid=b.classid) left join ctnclass c on a.nclassid=c.nclassid
//作用, 有時在文章表中包含了在個別類別表中沒有的數據, 用這個語法可以讀出文章表的全部數據
//a 為 文章表, b 為主類別, c 為子類別
7.4.3 同上例, 選擇追加數據時加上空格
程序代碼
Insert INTO cttag(articleid,classid,nclassid,tag)
Select a.articleid,a.classid,a.nclassid,d.class+' '+c.nclass
FROM
(ctarticle AS a left join (ctnclass c left join ctclass d on
c.classid=d.classid) on a.classid=c.classid and a.nclassid=c.nclassid)
LEFT JOIN cttag AS b ON a.articleid = b.articleid where a.classid=4 and
a.nclassid=154;
7.4.2 連接N個表, 并追加數據到其中一個表, N=4
程序代碼
Insert INTO cttag(articleid,classid,nclassid,tag)
Select a.articleid,a.classid,a.nclassid,d.class+c.nclass
FROM
(ctarticle AS a left join (ctnclass c left join ctclass d on
c.classid=d.classid) on a.classid=c.classid and a.nclassid=c.nclassid)
LEFT JOIN cttag AS b ON a.articleid = b.articleid where a.classid=1 and
a.nclassid=1;
//解讀
插入到 表2(欄1,欄2,欄3,欄4)
選擇 別名a.欄1, 別名a.欄2, 別名a.欄3, 別名d.欄4 加上 別名c.欄5
從
(表1 別名a 左連接 (表3 別名c 左連接 表4 別名d 在 別名c.欄2 等于 別名d.欄2) 在 別名a.欄2 等于 別名c.欄2 和
別名a.欄3=別名c.欄3) 左連接 表2 別名b 在 別名a.欄1 等于 別名b.欄1 在那里 別名a.欄2=1 和 別名a.欄3=1
7.4.1 連接兩個表, 并追加數據到其中一個表
程序代碼
Insert INTO cttag(articleid,classid,nclassid)
Select a.articleid,a.classid,a.nclassid
FROM ctarticle AS a LEFT JOIN cttag AS b ON a.articleid = b.articleid where a.classid=1 and a.nclassid=1;
//解讀
插入到 表2(欄1,欄2,欄3)
選擇 別名a.欄1, 別名a.欄2, 別名a.欄3
從 表1 別名a 左連接 表2 別名b 在 別名a.欄1 等于 別名b.欄1 在那里 別名a.欄4=1 和 別名a.欄5=1
7.4. 左連接
7.3.1 同步兩表的數據
程序代碼
Update ctarticle a INNER JOIN cttag b ON a.articleid = b.articleid SET b.classid=a.classid, b.nclassid=a.nclassid;
//解讀
更新 表1 別名a 聯接 表2 別名2 在 別名a.欄1 等于 別名b.欄1 設置 別名b.欄2 更新為 別名a.欄2, 別名b.欄3 更新為 別名a.欄3
7.3
程序代碼
select a.*, b.* from bunclass a right join ctclass b on a.classid=b.classid where a.nclassid=20
查詢別名 a,b 表, 只匹配 b 表中的內容.
7.2.3 添加數據到連接表之一
程序代碼
Insert INTO cttag ( tag, articleid ) Select top 1 b.tag,
a.articleid FROM ctarticle AS a left JOIN cttag AS b ON a.articleid =
b.articleid Where a.articleid order by a.articleid desc;
7.2.2 變通中的用法二
程序代碼
Insert INTO bureply
Select b.*, a.classid, a.nclassid
FROM article AS a INNER JOIN reply AS b ON a.articleid = b.articleid
Where classid=50;
7.2.1 實際應用中的變通
程序代碼
Insert INTO butag ( tag, articleid, classid, nclassid)
Select b.tag, a.articleid, a.classid, a.nclassid
FROM article AS a INNER JOIN tag AS b ON a.articleid = b.articleid
Where classid=24;
7.2 添加數據到其他表
程序代碼
Insert INTO butag ( tag, articleid )
Select b.tag, a.articleid
FROM article AS a INNER JOIN tag AS b ON a.articleid = b.articleid
Where a.articleid<>False;
//解讀
添加到 接收表(列1,列2)
選擇 別名b.列1, 別名a.列2
從 表1 表名a 聯接 表2 表名b 在 別名a.列c 等于 別名b.列c
在哪里 別名a.列c 不等于 沒有
7.1.1 實際應用中的變通
程序代碼
Select b.tag, a.articleid, a.classid, a.nclassid
FROM article AS a INNER JOIN tag AS b ON a.articleid = b.articleid
Where a.classid=24;
7.1 查詢
程序代碼
Select b.tag, a.articleid
FROM article AS a INNER JOIN tag AS b ON a.articleid = b.articleid
Where a.articleid<>False;
//解讀
選擇 別名b.列, 別名a.列
從 表1 別名a 聯接 表2 別名b 在 別名a.列c = 別名b.列c
在哪里 別名a.列c 不等于 沒有
注: as 不是必要
posted @ 2009-07-26 16:12 Robert Su 閱讀(244) | 評論 (0) | 編輯 收藏
posts - 103, comments - 104, trackbacks - 0, articles - 5
Copyright © Robert Su