district name https://forums.asp.net/t/2105578.aspx?district+name+Thu, 13 Oct 2016 11:16:24 -070021055786087080https://forums.asp.net/p/2105578/6087080.aspx?district+name+district name
<pre class="prettyprint ">ALTER procedure [dbo].[spGetpraptra11rptByDate]
(
@fromdate Date,
@todate Date
)
as
Begin
select
sum(p1.cell_02) as cell_02,
sum(p1.cell_03) as cell_03,
sum(p1.cell_04) as cell_04,
sum(p1.cell_05) as cell_05,
sum(p1.cell_06) as cell_06,
sum(p1.cell_07) as cell_07,
sum(p1.cell_08) as cell_08,
sum(p1.cell_09) as cell_09,
sum(p1.cell_10) as cell_10,
sum(p1.cell_11) as cell_11,
sum(p1.cell_12) as cell_12,
sum(p1.cell_13) as cell_13,
sum(p1.cell_14) as cell_14,
sum(p1.cell_15) as cell_15,
sum(p1.cell_16) as cell_16,
sum(p1.cell_17) as cell_17,
sum(p1.cell_18) as cell_18,
sum(p1.cell_19) as cell_19,
sum(p1.cell_20) as cell_20,
sum(p1.cell_21) as cell_21,
sum(p1.cell_22) as cell_22,
sum(p1.cell_23) as cell_23,
sum(p1.cell_24) as cell_24,
sum(p1.cell_25) as cell_25,
sum(p1.cell_26) as cell_26,
sum(p1.cell_27) as cell_27,
sum(p1.cell_28) as cell_28,
sum(p1.cell_29) as cell_29,
sum(p1.cell_30) as cell_30,
sum(p1.cell_31) as cell_31,
sum(p1.cell_32) as cell_32,
sum(p1.cell_33) as cell_33,
sum(p1.cell_34) as cell_34,
c.CircleHName from praptra11 p1, tblCircle c where p1.CircleId=c.CircleId and
(p1.r_date between @fromdate and @todate) group by c.CircleHName;
select p1.*, convert(varchar, r_date, 103) as EDate,c.CircleHName from praptra11 p1, tblCircle c where p1.CircleId=c.CircleId
and (p1.r_date between @fromdate and @todate) order by p1.CircleId
End</pre>
<p>above is my procedure.</p>
<p>i want to get district name in above procedure through [tblDistrict] table. how to modify above procedure.</p>
<p><strong>SELECT [DistrictId]</strong><br>
<strong>,[DistrictName]</strong><br>
<strong>,[DistrictHName]</strong><br>
<strong>,[Status]</strong><br>
<strong>,[CDate]</strong><br>
<strong>,[CBy]</strong><br>
<strong>FROM [tblDistrict]</strong></p>
2016-10-13T10:06:03-07:006087099https://forums.asp.net/p/2105578/6087099.aspx?Re+district+name+Re: district name
<p>Hello mike,</p>
<p>How can we relate the district table with the table and columns used in the SELECT statements of the procedure?</p>
<p></p>
<p>Is there a districtid column in tblCircle table?</p>
<p>If so then we will join these related tables using the foreign key columns</p>
2016-10-13T10:38:53-07:006087101https://forums.asp.net/p/2105578/6087101.aspx?Re+district+name+Re: district name
<p><span>Is there a districtid column in tblCircle table? </span></p>
<p><span>yes i have districtid column in tblCircle table</span></p>
<p><span></span></p>
<h3 class="post-title"><a title="eralper" href="https://forums.asp.net/members/eralper.aspx">eralper</a> i need to add only DistrictHName column in above procedure. So that in result i should get DistrictHName</h3>
2016-10-13T10:43:06-07:006087113https://forums.asp.net/p/2105578/6087113.aspx?Re+district+name+Re: district name
<p>Mike, please modify your SELECT statements according to followings</p>
<p></p>
<pre class="prettyprint lang-sql">select
.......
sum(p1.cell_33) as cell_33,
sum(p1.cell_34) as cell_34,
c.CircleHName,
<strong>d.DistrictName</strong>
from praptra11 p1,
tblCircle c,
<strong>tblDistrict d</strong>
where p1.CircleId=c.CircleId and
<strong>c.DistrictId=d.DistrictId and</strong>
(p1.r_date between @fromdate and @todate)
group by c.CircleHName<strong>, d.DistrictName</strong>;
select
p1.*, convert(varchar, r_date, 103) as EDate,c.CircleHName, d.DistrictName
from praptra11 p1, tblCircle c<strong>, tblDistrict d</strong>
where p1.CircleId=c.CircleId
<em>and c.DistrictId=d.DistrictId</em>
and (p1.r_date between @fromdate and @todate)
order by p1.CircleId
</pre>
<p>I hope it helps</p>
2016-10-13T11:16:24-07:00