sql,oracle10g,connect-by,hierarchical-query
I still don't know what happened (still not working) but this solution seems to work fine in both cases: SELECT IDBRANCH, ENDNODEIDCONTENT, IDCATEGORY, IDPARENTCATEGORY, TAXYJ.IDCONTENT, TCT.CONTENTNAME AS ENDNODECONTENTNAME, CATEGORYNAME, LVL FROM ( SELECT CONNECT_BY_ROOT TAXY.IDCATEGORY AS IDBRANCH , CONNECT_BY_ROOT TAXY.IDCONTENT AS ENDNODEIDCONTENT , TAXY.IDCATEGORY , TAXY.IDPARENTCATEGORY , TAXY.IDCONTENT , TAXY.CATEGORYNAME...
You should use GROUP BY UNIX_TIMESTAMP(time_stamp) DIV 600 or something like the following to work around: SELECT dt FROM ( SELECT DATE_SUB(NOW(),INTERVAL 20 MINUTE) AS dt UNION SELECT DATE_SUB(NOW(),INTERVAL 10 MINUTE) AS dt UNION SELECT NOW() AS dt ) a You want to go ahead and subtract with other subqueries...
A something like this should work for you (SQL Fiddle): WITH RECURSIVE q AS ( SELECT po.user_id,po.user_name,po.reports_to,po.position FROM pr_operators po WHERE po.reports_to = 'dpercival' UNION ALL SELECT po.user_id,po.user_name,po.reports_to,po.position FROM pr_operators po JOIN q ON q.user_id=po.reports_to ) SELECT * FROM q; You can read more on recursive CTE's in the docs....
oracle,siblings,connect-by,hierarchical-query
I get both rows with your last query as expected: SQL> SELECT * FROM SIBLINGSTEST 2 START WITH (col1 = 3 or col2 = 3) 3 CONNECT BY NOCYCLE ( 4 (PRIOR col1 = col1) or 5 (PRIOR col1 = col2) OR 6 (PRIOR col2 = col1) or 7 (PRIOR...
What you need is cumulative multiplication. But there is no such function either as Aggregate or Analytical function. But maths tells us multiplication can be changed to addition using logarithm. a * b = exp(ln(a) + ln(b)) Use this in SUM as analytical function. No need to use CONNECT BY...