The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
let's see whos good at sql
im breaking my head for about two hours, need a query to get the custom templates from the "template" table. what it needs to do, is a inner join that gets all templates which names doesn't exist in the master style (styleid -1). that's what I was able to come up with :/
Code:
SELECT t1.templateid, t1.styleid, t1.title, t2.styleid, t2.title FROM template AS t1, template AS t2 WHERE t1.templatetype = 'template' AND t2.templatetype = 'template' AND (t1.styleid <> -1 AND t1.title <> t2.title AND t2.styleid = -1) AND NOT (t1.styleid = -1 AND t1.title = t2.title AND t2.styleid = -1) GROUP BY t1.templateid, t2.title ORDER BY t1.title |
#2
|
|||
|
|||
You should look into something like:
[sql]SELECT * from template as t1 WHERE t1.title NOT IN (SELECT t2.title FROM template AS t2 WHERE t2.styleid = -1);[/sql] This is not the complete statement, but should get you started. |
#3
|
||||
|
||||
[sql]
SELECT customstyle.* FROM template AS customstyle LEFT JOIN template AS masterstyle ON (masterstyle.title = customstyle.title AND masterstyle.styleid = -1) WHERE ISNULL(masterstyle.templateid) [/sql] |
#4
|
||||
|
||||
thanks kirby, gonna use that one.
im having a problem calling $db->query_read() with it now, doesnt log errors in error_log and it seems to not even try the query. do i need to initialize something to use $db? |
#5
|
|||
|
|||
Quote:
|
#6
|
||||
|
||||
im including global.php... its weird, I tried query_read( somefunction() ), and it doesnt even enter the other function.
edit: BTW, anyone of you would know a query to remove all thread ratings made by the author of the thread? Quote:
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|