Hi,
Can you tell me if something like this is doable? Assume I have 2 tables as
follows:
Member(ID, Name, Gender)
Children(ID, FatherID, MotherID)
where ID, FatherID, MotherID are integers, Name is a character.
Assuming that I have the member's ID to start with, would it be possible to
display a row with the following:
ID, Name, [Father's Name], [Mother's Name] ?
Thank you
Please post onlySELECT M1.ID, M1.Name,
M2.Name as [Father's Name], M3.Name as [Mother's Name]
FROM Member M1
INNER JOIN Children C ON M1.ID=C.ID
INNER JOIN Member M2 ON C.FatherID=M2.ID
INNER JOIN Member M3 ON C.MotherID=M3.ID
Razvan|||Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.programming:511725
No. I get the same name twice (the member's name is the same as the father)
Thank you
Please post only
"Razvan Socol" <rsocol@.gmail.com> wrote in message
news:1110348053.094178.253040@.f14g2000cwb.googlegroups.com...
> SELECT M1.ID, M1.Name,
> M2.Name as [Father's Name], M3.Name as [Mother's Name]
> FROM Member M1
> INNER JOIN Children C ON M1.ID=C.ID
> INNER JOIN Member M2 ON C.FatherID=M2.ID
> INNER JOIN Member M3 ON C.MotherID=M3.ID
> Razvan
>|||Xref: TK2MSFTNGP08.phx.gbl microsoft.public.sqlserver.programming:511727
Oops... sorry my mistake. Thank you very much.
Thank you
Please post only
"!!bogus" <hello@.microb.com> wrote in message
news:bxNXd.22362$fW4.668343@.news20.bellglobal.com...
> No. I get the same name twice (the member's name is the same as the
father)
>
Showing posts with label doable. Show all posts
Showing posts with label doable. Show all posts
Wednesday, March 21, 2012
Is this doable?
On the report table, there are 3 fields called Beginning Amount, Used Amount
and Remaining Amount respectively. The Beginning Amount and Used Amount field
are retrieved from the SQL database, while the Remaining Amount needs to be
calculated from the previous record, e.g, ItemB's RemainingAmount = ItemA's
RemainingAmount - ItemB's UsedAmount. Basides subreport and global variable,
is there any easy way to do it? what is a good approach here?
Example,
Beginning Amount: $1000
============================================== Name Used Amount Remaining Amount
============================================== Item A 100 900
Item B 200 700
Item C 100 600
Thanks.
ShawnYes it is doable with the RunningValue function.
See BOL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rscreate/htm/rcr_creating_expressions_v1_5tt1.asp
The remaining amount would be e.g.:
= 1000 - RunningValue(Fields!Amount.Value, Sum, Nothing)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Sean" <Sean@.discussions.microsoft.com> wrote in message
news:7E302ED6-E26D-4307-A190-F2573050CD85@.microsoft.com...
> On the report table, there are 3 fields called Beginning Amount, Used
Amount
> and Remaining Amount respectively. The Beginning Amount and Used Amount
field
> are retrieved from the SQL database, while the Remaining Amount needs to
be
> calculated from the previous record, e.g, ItemB's RemainingAmount =ItemA's
> RemainingAmount - ItemB's UsedAmount. Basides subreport and global
variable,
> is there any easy way to do it? what is a good approach here?
>
> Example,
> Beginning Amount: $1000
> ==============================================> Name Used Amount Remaining Amount
> ==============================================> Item A 100 900
> Item B 200 700
> Item C 100 600
> Thanks.
> Shawn
>|||Robert Bruckner [MSFT] wrote:
> Yes it is doable with the RunningValue function.
> See BOL:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rscreate/htm/rcr_creating_expressions_v1_5tt1.asp
> The remaining amount would be e.g.:
> = 1000 - RunningValue(Fields!Amount.Value, Sum, Nothing)
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Sean" <Sean@.discussions.microsoft.com> wrote in message
> news:7E302ED6-E26D-4307-A190-F2573050CD85@.microsoft.com...
>>On the report table, there are 3 fields called Beginning Amount, Used
> Amount
>>and Remaining Amount respectively. The Beginning Amount and Used Amount
> field
>>are retrieved from the SQL database, while the Remaining Amount needs to
> be
>>calculated from the previous record, e.g, ItemB's RemainingAmount => ItemA's
>>RemainingAmount - ItemB's UsedAmount. Basides subreport and global
> variable,
>>is there any easy way to do it? what is a good approach here?
>>
>>Example,
>>Beginning Amount: $1000
>>==============================================>>Name Used Amount Remaining Amount
>>==============================================>>Item A 100 900
>>Item B 200 700
>>Item C 100 600
>>Thanks.
>>Shawn
>>
>
>
RunningValue solves it.sql
and Remaining Amount respectively. The Beginning Amount and Used Amount field
are retrieved from the SQL database, while the Remaining Amount needs to be
calculated from the previous record, e.g, ItemB's RemainingAmount = ItemA's
RemainingAmount - ItemB's UsedAmount. Basides subreport and global variable,
is there any easy way to do it? what is a good approach here?
Example,
Beginning Amount: $1000
============================================== Name Used Amount Remaining Amount
============================================== Item A 100 900
Item B 200 700
Item C 100 600
Thanks.
ShawnYes it is doable with the RunningValue function.
See BOL:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rscreate/htm/rcr_creating_expressions_v1_5tt1.asp
The remaining amount would be e.g.:
= 1000 - RunningValue(Fields!Amount.Value, Sum, Nothing)
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Sean" <Sean@.discussions.microsoft.com> wrote in message
news:7E302ED6-E26D-4307-A190-F2573050CD85@.microsoft.com...
> On the report table, there are 3 fields called Beginning Amount, Used
Amount
> and Remaining Amount respectively. The Beginning Amount and Used Amount
field
> are retrieved from the SQL database, while the Remaining Amount needs to
be
> calculated from the previous record, e.g, ItemB's RemainingAmount =ItemA's
> RemainingAmount - ItemB's UsedAmount. Basides subreport and global
variable,
> is there any easy way to do it? what is a good approach here?
>
> Example,
> Beginning Amount: $1000
> ==============================================> Name Used Amount Remaining Amount
> ==============================================> Item A 100 900
> Item B 200 700
> Item C 100 600
> Thanks.
> Shawn
>|||Robert Bruckner [MSFT] wrote:
> Yes it is doable with the RunningValue function.
> See BOL:
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/rscreate/htm/rcr_creating_expressions_v1_5tt1.asp
> The remaining amount would be e.g.:
> = 1000 - RunningValue(Fields!Amount.Value, Sum, Nothing)
> --
> This posting is provided "AS IS" with no warranties, and confers no rights.
>
> "Sean" <Sean@.discussions.microsoft.com> wrote in message
> news:7E302ED6-E26D-4307-A190-F2573050CD85@.microsoft.com...
>>On the report table, there are 3 fields called Beginning Amount, Used
> Amount
>>and Remaining Amount respectively. The Beginning Amount and Used Amount
> field
>>are retrieved from the SQL database, while the Remaining Amount needs to
> be
>>calculated from the previous record, e.g, ItemB's RemainingAmount => ItemA's
>>RemainingAmount - ItemB's UsedAmount. Basides subreport and global
> variable,
>>is there any easy way to do it? what is a good approach here?
>>
>>Example,
>>Beginning Amount: $1000
>>==============================================>>Name Used Amount Remaining Amount
>>==============================================>>Item A 100 900
>>Item B 200 700
>>Item C 100 600
>>Thanks.
>>Shawn
>>
>
>
RunningValue solves it.sql
Subscribe to:
Posts (Atom)