Hi All,
I have a question regarding cumulative calculation where I want to calculate row by row Invoice and Payment.
Here is the sample data and my desired output.
Cust/Month/Trans/Amount/CumulativeBal(my desired output)
1, 1, Due, 100, 100
1, 1, Payment, 50, 50
1, 1, Payment, 50, 0
1, 2...
try this:
SELECT DISTINCT oq.id
, STUFF((SELECT ' ' + inq.note AS [text()]
FROM #Test inq
WHERE inq.id = oq.id
FOR XML PATH('')), 1, 1, '')AS qt
FROM #Test oq;
Updated ddl
create table #test
(ID int, Text varchar(10))
insert into #test
select 1, 'ab'
union all
select 1, 'ab'
union all
select 2, 'cd'
union all
select 2, 'df'
union all
select 3, 'ab'
union all
select 3, 'cd'
union all
select 3, 'df'
union all
select 4, 'xy'
union all
select 4, 'xy'...
Tamar,
There can be more than two records, same thing applies if all the records with same ID matched then it has to be matched or else unmatched.
Thanks!
Hi All,
how to identify different fields with in a group of records?
Example:
create table #test
(ID int, Text varchar(10))
insert into #test
select 1, 'ab'
union all
select 1, 'ab'
union all
select 2, 'cd'
union all
select 2, 'df'
select * from #test
I want to show additional field as...
Code has some errors, here is the edited:
CREATE TABLE #XY123
(
tktamt MONEY,
departcty VARCHAR(5),
arrivalcty VARCHAR(5),
tktnum INT
)
INSERT INTO #XY123
SELECT '100.00',
'DFW',
'LGA',
12345
UNION ALL
SELECT '120.00',
'MIA'...
Hi all,
I have a question regarding the selection of arrival and departure city.
CREATE TABLE #XY123
(
tktamt MONEY,
departcty VARCHAR(5),
arrivalcty VARCHAR(5),
tktnum INT
)
INSERT INTO #XY123
SELECT '100.00',
'DFW',
'LGA',
12345
UNION...
Hi All,
I need your valuable inputs about the production change in our database that is affecting reports, the application team has introduced an additional field to the tables in our database, with addition of that field we have to add an additional join condition and there are around 200...
Hi All,
I have groupings in my report, one of the groupings is preferred clients which has all the customers and some elite customers, which can be identified based on the elite phone num field if it is null or not, determines a elite customer, I have top 15 clients for which I want to display...
Hi All,
I am using Crystal 2011, is there a way to display Value and percentage on the pie chart, I can see the option to display it in the legend, but not next to the pie's, I can just display either value or percent but not both.
Thanks for the help!
Thanks Chris and Carp!
SQL statement solution worked perfectly, and gave me exactly what I wanted.
Any suggestion for the same thing for a week, date before last five business days, if it is holiday/saturdat/Sunday, then get the day before it.
I wrote this, but want to know if it can be...
Hi All,
Can this query be further shrinked/optimized?
I am getting here the first working day of the month.
xxwfs_get_work_day is a function based on a holiday table which returns "1" for a federal holiday, "2" for saturday and sunday and "0" for a working day.
SELECT (CASE
WHEN...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.