Hi,
New to .Net and SQL. I have two tables that I have joined together. RentalControl_Main has the rental informationd and an Adjuster ID that links to the ADjuster table and the adjusters name. I am trying to create a report that gives the "Single" adjuster name and the totals for all of their contracts. I have a details report that gives each contract info. for each specific adjusters rentals. However, I want to just list the adjuster once and give all of their totals. In my SQL statement I have all of it written out and just need to knowwhat to do in place of 'Alex Early' that will give me all of the distinct adjusters.
Do I need to code this on the page with a do while loop?
Appreciate any help.
SELECT SUM(dbo.RentalControl_Main.Rate) / COUNT(dbo.RentalControl_Main.Rate) AS AmtAvg, SUM(dbo.RentalControl_Main.DaysBilled)
/ COUNT(dbo.RentalControl_Main.DaysBilled) AS DayAvg, SUM(dbo.RentalControl_Main.Rate * dbo.RentalControl_Main.DaysBilled)
/ COUNT(dbo.RentalControl_Main.Rate) AS TotAvg
FROM dbo.RentalControl_Main INNER JOIN
dbo.RentalControl_Adjuster ON dbo.RentalControl_Main.AdjusterID = dbo.RentalControl_Adjuster.AdjusterID
WHERE (dbo.RentalControl_Adjuster.AdjusterName = 'Alex Early' AND (dbo.RentalControl_Main.DateClose IS NOT NULL) AND
(dbo.RentalControl_Main.AgencyID = '2')I don't mean to sound off-ish, but do you know much about GROUP BY and DISTINCT?
Showing posts with label links. Show all posts
Showing posts with label links. Show all posts
Friday, March 30, 2012
Wednesday, March 21, 2012
Queries run against database
Is it possible to tell on sql server what queries are run
against it?
If a program is built within a company and it links to a
SQL server that I manage. Can I tell what is run against
it?
Thanks,
JeffSure. Use Profiler!
--
Tibor Karaszi
"Jeff" <anonymous@.discussions.microsoft.com> wrote in message
news:0c9f01c3a2e9$f8cab620$a601280a@.phx.gbl...
> Is it possible to tell on sql server what queries are run
> against it?
> If a program is built within a company and it links to a
> SQL server that I manage. Can I tell what is run against
> it?
> Thanks,
> Jeff|||Thanks. I forgot about all those other programs in the
Start Menu.
Jeff
>--Original Message--
>Sure. Use Profiler!
>--
>Tibor Karaszi
>
>"Jeff" <anonymous@.discussions.microsoft.com> wrote in
message
>news:0c9f01c3a2e9$f8cab620$a601280a@.phx.gbl...
>> Is it possible to tell on sql server what queries are
run
>> against it?
>> If a program is built within a company and it links to
a
>> SQL server that I manage. Can I tell what is run
against
>> it?
>> Thanks,
>> Jeff
>
>.
>sql
against it?
If a program is built within a company and it links to a
SQL server that I manage. Can I tell what is run against
it?
Thanks,
JeffSure. Use Profiler!
--
Tibor Karaszi
"Jeff" <anonymous@.discussions.microsoft.com> wrote in message
news:0c9f01c3a2e9$f8cab620$a601280a@.phx.gbl...
> Is it possible to tell on sql server what queries are run
> against it?
> If a program is built within a company and it links to a
> SQL server that I manage. Can I tell what is run against
> it?
> Thanks,
> Jeff|||Thanks. I forgot about all those other programs in the
Start Menu.
Jeff
>--Original Message--
>Sure. Use Profiler!
>--
>Tibor Karaszi
>
>"Jeff" <anonymous@.discussions.microsoft.com> wrote in
message
>news:0c9f01c3a2e9$f8cab620$a601280a@.phx.gbl...
>> Is it possible to tell on sql server what queries are
run
>> against it?
>> If a program is built within a company and it links to
a
>> SQL server that I manage. Can I tell what is run
against
>> it?
>> Thanks,
>> Jeff
>
>.
>sql
Subscribe to:
Posts (Atom)