-
Notifications
You must be signed in to change notification settings - Fork 0
/
SQLLIST.txt
48 lines (31 loc) · 3.21 KB
/
SQLLIST.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
SELECT `Tag` . `name`
FROM `User_TBL`INNER JOIN `Tag` ON `User_TBL` . `profileID` = `Tag` . `ID`
SELECT `Tag` . * , `LINK`.`quant` ,`PTag`.`name` AS Pname FROM `User_TBL` INNER JOIN `Tag` AS PTag ON `User_TBL` . `profileID` = `PTag` . `ID` , `LINK` , `Tag` WHERE `LINK`.`LTo` =100000 AND `LINK`.`LFrom` = `Tag`.`ID`
SELECT `Tag`.* , `userP`.`name` AS userProfile FROM `Tag` AS userP ,`User_TBL` INNER JOIN `Tag` ON `User_TBL` . `profileID` = `Tag` . `owner` WHERE `Tag` .`name` LIKE '$addTagName' AND `userP`.`ID` = `User_TBL` . `profileID`
//すでに同一親記事に対してタグがリンクされているか探す
SELECT *
FROM `Tag`
WHERE `name` LIKE '生涯'
SELECT `Tag`,* ,`User_TBL`.* FROM
`User_TBL` INNER JOIN `Tag` ON `User_TBL` . `profileID` = `Tag` . `ID` WHERE `name` LIKE '生涯'
SELECT *
FROM `Tag`
WHERE `name` LIKE '$search1'
$sql = "SELECT * FROM `Tag` WHERE `name` LIKE '%$search1%'
SELECT `Tag` . * , `LINK`.`quant` ,`PTag`.`name` AS Pname FROM
`User_TBL` INNER JOIN `Tag` AS PTag ON `User_TBL` . `profileID` = `PTag` . `ID` , `LINK` , `Tag` WHERE `LINK`.`LTo` =$article[ID] AND `LINK`.`LFrom` = `Tag`.`ID`
SELECT `Tag`.* ,`User_TBL`.* FROM
`User_TBL` INNER JOIN `Tag` ON `User_TBL` . `profileID` = `Tag` . `owner` WHERE `Tag` .`name` LIKE '生涯'
//タグ取得の時に
SELECT `Tag`.* , `userP`.`name` FROM `Tag` AS userP ,`User_TBL` INNER JOIN `Tag` ON `User_TBL` . `profileID` = `Tag` . `owner` WHERE `Tag` .`name` LIKE '生涯' AND `userP`.`ID` = `User_TBL` . `profileID`
https://docs.google.com/drawings/d/18Vu7KOnu1wDFAEFFqch-SOyLFzAHSzF4pxcMoz51pkM/edit?usp=sharing
SELECT `LINC` . `LTo` FROM `LINK` ,`LINK` AS `Parent_link`
//リプライ取得 記事IDを入力すると、 その記事をfrom としたリンクが全てとれてくるように
SELECT `article`.`ID`, `article`.`name` FROM `LINK` INNER JOIN `article` ON `LINK` . `LTo` = `article` . `ID` WHERE `LINK`.`LFrom` =$article[ID]
SELECT `LINK`. `LFrom`, `tagLink` . `LFrom`, `tagLink` . `LTo`, `article` . * FROM `LINK` INNER JOIN `LINK` AS tagLink ON `LINK` . `ID` = `tagLink` . `LTo` , `article` WHERE `LINK`.`LFrom` =100000 AND `article` . `ID` = `tagLink` . `LTo`
SELECT `LINK`. `LFrom`, `tagLink` . `LFrom`, `tagLink` . `LTo`, `article` . * FROM `LINK` JOIN `LINK` AS tagLink ON `LINK` . `ID` = `tagLink` . `LTo` , `article` WHERE `LINK`.`LFrom` =100000 AND `article` . `ID` = `tagLink` . ` LFrom`
SELECT `LINK`. `LFrom`, `tagLink` . `LFrom`, `tagLink` . `LTo`, `article` . * FROM `LINK`, `LINK` AS tagLink, `article` WHERE `LINK` . `ID` = `tagLink` . `LTo` AND `LINK`.`LFrom` =100000 AND `article` . `ID` = tagLink . `LTo`
//
SELECT `tagLink`.`LFrom` AS TLFROM, `article` . * FROM `LINK` INNER JOIN `LINK` AS tagLink ON `LINK`.`ID` = `tagLink`.`LTo`, `article` WHERE `LINK`.`LFrom` =$articleFrom AND `tagLink`.`LFrom` =$linkTag AND `article` . `ID` = `LINK` . `LTo`
UPDATE `db0tagplus`.`LINK` SET `quant` = '$articleEdit' WHERE `LINK`.`ID` = $articleID;
SELECT `tagLink`.`LFrom` AS TLFROM, `Tag` . * FROM `LINK` INNER JOIN `LINK` AS tagLink ON `LINK`.`ID` = `tagLink`.`LTo`, `Tag` WHERE `LINK`.`LFrom` =$targetTagIDFrom AND `tagLink`.`LFrom` =$tagSSugID AND `article` . `ID` = `LINK` . `LTo` AND `LINK`.`LTo` LIKE '%addTagName%';"; //親タグと当該タグのリンク重複を調べる