i have 3 tables
1. regi
in that regi fields are - id - sponserid - introducerid- name- position
-
1- null- 0 - devi- o
-
2 - devi- 1- kasi- 2
-
3- devi - 1- subbu- 1
-
4. kasi - 2- mahi-2
-
5. kasi- 2- ram- 1
-
6. subbu- 3 - lucky-1
-
7. subbu- 3- harsha-2
2. position table - pid -position
-
1 - right
-
2 - left
-
3. sponsers table - cid- name
-
1 - devi
-
2- kasi
-
3- subbu
how can i get childs nodes from left and right of a particular parent.
here i used the save stored procedure in savere - ALTER PROCEDURE [dbo].[savere]
-
@sponserid varchar(50),
-
@introducerid int,
-
@placedunderid varchar(50),
-
@name varchar(50),
-
@so varchar(50),
-
@position int,
-
@gender int,
-
@occupation varchar(50),
-
@dob varchar(50),
-
@addr varchar(200),
-
@area varchar(50),
-
@city varchar(50),
-
@district varchar(50),
-
@state varchar(50),
-
@pincode varchar(50),
-
@email varchar(50),
-
@landline varchar(50),
-
@mobileno varchar(50),
-
@pwd varchar(50),
-
@pin varchar(50),
-
@nominee varchar(50),
-
@relation varchar(50),
-
@age varchar(50),
-
@bankpayeename varchar(50),
-
@accno varchar(50),
-
@bankname varchar(50),
-
@branch varchar(50),
-
@ifsc varchar(50)
-
-
-
AS
-
BEGIN
-
-- SET NOCOUNT ON added to prevent extra result sets from
-
-- interfering with SELECT statements.
-
SET NOCOUNT ON;
-
-
-- Insert statements for procedure here
-
insert into re
-
(
-
sponserid ,
-
introducerid ,
-
placedunderid ,
-
name ,
-
so ,
-
position ,
-
gender ,
-
occupation ,
-
dob ,
-
addr ,
-
area ,
-
city ,
-
district ,
-
state ,
-
pincode ,
-
email ,
-
landline ,
-
mobileno ,
-
pwd ,
-
pin ,
-
nominee ,
-
relation ,
-
age ,
-
bankpayeename ,
-
accno ,
-
bankname ,
-
branch ,
-
ifsc,
-
createddate
-
)
-
values
-
(
-
@sponserid ,
-
@introducerid ,
-
@placedunderid ,
-
@name ,
-
@so ,
-
@position ,
-
@gender ,
-
@occupation ,
-
@dob ,
-
@addr ,
-
@area ,
-
@city ,
-
@district ,
-
@state ,
-
@pincode ,
-
@email ,
-
@landline ,
-
@mobileno ,
-
@pwd ,
-
@pin ,
-
@nominee ,
-
@relation ,
-
@age ,
-
@bankpayeename ,
-
@accno ,
-
@bankname ,
-
@branch ,
-
@ifsc ,GETDATE()
-
)
-
-
declare @cid int
-
set @cid =SCOPE_IDENTITY()
-
-
insert into sponsers(cid,name)values(@cid,@name)
-
END
1 1585
Please use code tags when posting code or formatted data. Second Warning.
The answer to this question is the same as the answer to your other thread about counting all the child nodes: https://bytes.com/topic/sql-server/a...tion-calculate.
You will need to write a complicated recursive query using CTE's or you will need to change the data structure to accommodate easier queries. The choice is up to you. You can get more detail about each approach in the links in your other thread.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: mitsura |
last post by:
Hi,
I have included a small listing. The test program opens a panel and
show a bitmap.
What I want is to when the mouse is over the bitmap panel, I want to
trap the left mouse click.
The...
|
by: A.M |
last post by:
Hi,
Using C#, what is the equivalent of functions Left, Right and Mid that we
had in vb6?
Thanks,
Alan
|
by: Bruce A. Julseth |
last post by:
I have:
If (Microsoft.VisualBasic.Left(TextBox1.Text, 1) = "$") Then
TextBox1.Text = Microsoft.VisualBasic.Right(TextBox1.Text,
TextBox1.Text.Length - 1)
End If
Adding: Imports...
|
by: James Brown [MVP] |
last post by:
Hi,
I am having trouble understanding how the 'const' modifier affects the
'left-right' rule when deciphering c-declarations:
const int *x; // x is a pointer to a 'const int'
int const *x; ...
|
by: Chaitanya |
last post by:
Hello, In my Application i want to know when user clicks both the
"Left" and "Right" buttons of the Mouse.
I am getting a number like this "3145728". But the MouseButtons Enum
contains only Left,...
|
by: karthee |
last post by:
I am creating a custom treeview with multiple selection, if i select
multiple nodes and right click, the selection is disappearing,
i tried with somany things like
on mouse click my code is...
|
by: |
last post by:
What are the equivalant to left, right, etc. in C#. How can I extract
strings from a string without them? For instance, I have a string like so:
...
|
by: shapper |
last post by:
Hello,
I am used to SQL but I am starting to use LINQ.
How can I create Left, Right and Inner joins in LINQ? How to
distinguish the different joins?
Here is a great SQL example:...
|
by: ImpactMan |
last post by:
Need help to create an windows mobile application with a few buttons that when they are pressed/clicked they assign keys, like up, down, left, right.
It is just like to create a "virtual d-pad",...
|
by: jitenrajput49 |
last post by:
My tbltestingtree structure is as follow:
ID ParentID IsLeft IsRight joingdate
Ramesh123 NULL NULL NULL 2014-01-03...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |