Query Help

jamjam200

New member
Local time
Today, 19:06
Joined
Jun 13, 2006
Messages
4
I am trying to get the following information

1) Total number of calls from table tbl_ALL
2) Oldest Call from table tbl_ALL

I need the results to be on one line and not to be grouped by business name

Currently I am using two separate queries

1) This query gets the oldest call in the table and which business is belongs to

Select OldestContact, businessName

from tbl_ALL
Where OldestContact=(Select MAX(OldestContact) from tbl_ALL)


2) This query gets the total number of calls in using SUM from the table

Select
Sum(totalCalls) AS Total_Calls
from tbl_ALL
 
>>> I need the results to be on one line and not to be grouped by business name <<<

So does this mean you will be displaying the results in a text box?
 
Try:

Select OldestContact, businessName, (Select Sum(totalCalls) AS Total_Calls from tbl_ALL) AS TotalCalls
from tbl_ALL
Where OldestContact=(Select MAX(OldestContact) from tbl_ALL)
 
Try:

Select OldestContact, businessName, (Select Sum(totalCalls) AS Total_Calls from tbl_ALL) AS TotalCalls
from tbl_ALL
Where OldestContact=(Select MAX(OldestContact) from tbl_ALL)

perfect -thanks

Is it possible to also get the Latest Call and the relevant business name at the same time as the oldest call?
 

Users who are viewing this thread

Back
Top Bottom