Jump to content
JasperReports Library 7.0 is now available ×

sql query not returning results


Recommended Posts

By: Jessica Daniel - jrdorbital

sql query not returning results

2003-01-29 07:41

The following sql query is returning an empty result set when executed. I have tried placing Begin and End statements around it since it is a compound query. The query will generate results in query analyzer. Are any bugs or limitations on how a sql query must be set up if it consists of more than one statement?

 

Thanks

Jessica

 

SELECT DISTINCT

OrganizationName, VehicleName, VehicleSpeed, AirTemp, RoadTemp, EngineTemp, DrySandRate, SandWettingRate

INTO #aggregate

FROM

sde.OrbTrac_geoData data

JOIN sde.OrbTrac_VehicleGroupVehicle vgv ON data.VID=vgv.VehicleID

JOIN sde.OrbTrac_Vehicle v ON data.VID = v.VehicleID

JOIN sde.OrbTrac_Organization org ON v.OrgID = org.OrganizationID

WHERE

( GeoTime BETWEEN '12/29/02 9:00 AM' AND '12/29/02 3:00 PM' )

AND vgv.VehicleGroupId = 'cbb3f58e-30c9-4c6e-90aa-7df7229f16c1'

SELECT OrganizationName, VehicleName, Avg(VehicleSpeed) as VehicleSpeed, Avg(AirTemp) as AirTemp, Avg(RoadTemp) as RoadTemp, Avg(EngineTemp) as EngineTemp, Avg(DrySandRate) as DrySandRate, Avg(SandWettingRate) as SandWettingRate

FROM #aggregate

GROUP BY VehicleName, OrganizationName

ORDER BY OrganizationName

DROP Table #aggregate

 

 

 

 

By: Chuck Deal - cdeal

RE: sql query not returning results

2003-01-29 08:31

You may want to stick that query inside a stored procedure. Then you can be sure that all of the complexity is handled properly (on the db server). Since it looks like you are just trying to return a single resultset, then your problem should clear up.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...