Hi
I would like to build a tree of Organisations.
I use the following mapping and class.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2">
<class name="Foundation.DomainModels.Organisation, Foundation" table="Organisation" lazy="true">
<id name="Id" column="ID" type="Int32" unsaved-val...
Does JPA 2 have any mechanism for running recursive queries?
Here's my situation: I have an entity E, which contains an integer field x. It also may have children of type E, mapped via @OneToMany. What I'd like to do is find an E by primary key, and get its value of x, along with the x values of all its descendants. Is there any way to ...
i have this files:
//Q2a.h
#ifndef Q2A_H
#define Q2A_H
inline int MyFactorial(int a)
{
if (a < 2)
return 1;
return a*MyFactorial(a-1);
}
int NumPermutations(int b);
#endif
//Q2a.cpp
#include "Q2a.h"
int NumPermutations(int b)
{
return MyFactorial(b);
}
and file with the main- Q2b.cpp
i notice that the compiler usually ig...
Hello,
I am using postgresql. I have the table as like below
parent_id child_id
----------------------
101 102
103 104
104 105
105 106
I want to write a sql query which will give the final parent of input.
i.e suppose i pass 106 as input then , its output will be 103.
(106 --> 105 --> 104 --> 103)
...
I'm trying to make a function that recursively builds a path for a specific category
CREATE FUNCTION getPath(inId INT)
RETURNS TEXT
DETERMINISTIC
BEGIN
DECLARE return_path TEXT;
DECLARE return_parent_id INT;
SELECT CONCAT('/', name) INTO return_path FROM article_categories WHERE id = inId;
SELECT parent_id INTO return_pa...
Lets say I have the following table
User_ID Manager_ID
---------------------
Linda Jacob
Mark Linda
Kevin Linda
Steve Mark
John Kevin
Basically the requirement is to pull all the managers under the user_id you are searching for. So for instance if I send in 'Linda' then it should retur...
I have the following table.
CREATE TABLE IF NOT EXISTS `omc_schedule` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`trainer_id` int(11) NOT NULL,
`course` varchar(255) NOT NULL,
`capacity` int(11) NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`parentid` int(10) NOT NULL,
`order` int(11) NOT...
Hello,
I am new to SQL Server development. Most of my experience has been done with Oracle.
suppose I have the following table that contains Appointments objects
CREATE TABLE [dbo].[Appointments](
[AppointmentID] [int] IDENTITY(1,1) NOT NULL,
.......
[AppointmentDate] [datetime] NOT NULL,
[PersonID] [int] NOT NULL,
...
I am using Hostek.com, shared hosting, and can't seem to get a recursive function to run.
...
I have the following data set, which represents nodes in a directed graph.
CREATE TABLE nodes (NODE_FROM VARCHAR2(10),
NODE_TO VARCHAR2(10));
INSERT INTO nodes VALUES('GT','TG');
INSERT INTO nodes VALUES('GG','GC');
INSERT INTO nodes VALUES('AT','TG');
INSERT INTO nodes VALUES('TG','GC');
INSERT INTO nodes VALUES('G...
Hi
I'm trying to create a query on a very simple table (organisations)
I have the columns
Organisation, Manager, Superior_Organisation
CEO
Leadership Team, David, CEO
Production Management, Alex, Leadership Team
Production Site 1, Francoise, Production Management
Production Site 2, Steve, Production Management
Production Site 1 Maint...
Given the following table:
create table TreeNode
(
ID int not null primary key,
ParentID int null foreign key references TreeNode (ID)
)
How could I write a common table expression to start at the root (WHERE ParentID IS NULL) and traverse its descendants until the result set contains some target node (e.g., WHERE ID = n)? It's ea...
I have a table which contains the following fields
Supervisorid
Empid
This is just like a referral program. A guy can refer 3 guys under him i.e, 3 is referring three guys namely 4 5 8 similarly 4 is referring 9 10 and 11 likewise 8 is referring 12, 13 it goes like this..
I want a query to get all EmpId under Supervisor 3
...
Some days ago I asked a question on SO regarding help on a recursive query.
The problem of that question was "How to get the history of a Person appointments".
Now I am having a problem similar to that one but it should answer to a slightly different question:
How to get an Appointment history?
For example if Appointment with ID = 5...
I've a relational table (id, parentId, name)
which I'd like to convert to a flattened dimentional table
(id, Level1, Level2, Level3, Level4)
I'm ok fixing the depth at 4 deep.
I've made progress with a recursive CTE and pivot, but the result set isn't right
I get
Id Name Level1 Level2
0 Root NULL NULL
1 NULL L1 NUL...
Spent a few hours on this and need some expert help.
I have a table like this:
[id] [name] [parent_id]
1 fruits 0
2 orange 1
3 lemon 2
4 steak 0
When I go to lemon, I want the breadcrumb to be like:
Home > Fruits > Orange > Lemon
And lemon not to be a link but the rest to be a link.
Any suggestions?
The best I f...