Pastoid

Nested Set Children

The page you are looking at now is at this URL: http://pastoid.com/axa

This paste was last updated on May 6, 2009 at 6:55 pm.

Pasted Coderaw

SELECT term.term, term.mptt_left, term.mptt_right, COUNT(*) AS depth,
	(SELECT COUNT(*)+1
	FROM {terms} AS t1
	INNER JOIN {terms} AS t2
		ON t1.mptt_left BETWEEN t2.mptt_left AND t2.mptt_right
	WHERE t1.term = @myterm) AS child_depth
FROM {terms} AS term
INNER JOIN {terms} AS t2
	ON term.mptt_left BETWEEN t2.mptt_left AND t2.mptt_right
GROUP BY term.term
HAVING term.mptt_left BETWEEN @myterm_left+1 AND @myterm_right-1
AND depth = child_depth
ORDER BY NULL;

Toggle wordwrap

Referring DomainHits
Unknown Referer 127
pastoid.com 8
search.live.com 1
www.w9busca.com 1
Is this paste spam?
<Hide