something like this?
but im getting this error...

===============error text======================

Server: Msg 156, Level 15, State 1, Line 13
Incorrect syntax near the keyword 'select'.
Server: Msg 170, Level 15, State 1, Line 13
Line 13: Incorrect syntax near '>'.

===============error text======================

select r.IpAddressNumber, v.VehicleIp,
Count(r.ReportId) as ReportsInDatabase,
Count(DISTINCT Time) as DistinctTimes, v.VehicleName, c.companyName
from reportsView r
INNER JOIN
vehicletable v
on v.IpAddressNumber = r.IpAddressNum
INNER JOIN
companyTable c
on v.companyIdNumber = c.companyIdNumber
where r.currentDate between '09-29-2003 00:00:00.000'  and '09-29-2003
23:59:59.999'
Group By v.IpAddressNumber, r.IpAddressNum, v.VehicleName, v.VehicleIp,
c.companyName
HAVING select (((reportsInDatabase - distinctTimes) / reportsInDatabase) *
100) > 15
Order by ReportsInDatabase DESC


...tony

tony weeg
senior web applications architect
navtrak, inc.
www.navtrak.net
[EMAIL PROTECTED]
410.548.2337

-----Original Message-----
From: Tony Weeg [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 01, 2003 10:51 AM
To: CF-Talk
Subject: ot: sql question

how would I use HAVING to select out where the difference between
reportsInDatabase and DistinctTimes is above 15% im stuck and its just not
clicking this morning....thanks if you can figure this out....

select r.IpAddressNumber, v.VehicleIp,
Count(r.ReportId) as ReportsInDatabase, Count(DISTINCT Time) as
DistinctTimes, v.VehicleName, c.companyName from reportsView r INNER JOIN
vehicletable v on v.IpAddressNumber = r.IpAddressNum INNER JOIN companyTable
c on v.companyIdNumber = c.companyIdNumber where r.currentDate between
'09-29-2003 00:00:00.000'  and '09-29-2003 23:59:59.999'
Group By v.IpAddressNumber, r.IpAddressNum, v.VehicleName, v.VehicleIp,
c.companyName Order by ReportsInDatabase DESC

im stuck

...tony

tony weeg
senior web applications architect
navtrak, inc.
www.navtrak.net
[EMAIL PROTECTED]
410.548.2337

________________________________


[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to