[thelist] SQL Query Help

Tab Alleman talleman at Lumpsum.com
Wed Mar 1 13:56:53 CST 2006


UNION with a query that returns "Agencies" that do not meet the criteria?

> -----Original Message-----
> From: thelist-bounces at lists.evolt.org
> [mailto:thelist-bounces at lists.evolt.org]On Behalf Of Michael Pack
> Sent: Wednesday, March 01, 2006 11:40 AM
> To: thelist at lists.evolt.org
> Subject: [thelist] SQL Query Help
> 
> 
> Hi all, I'm stuck a bit and drawing blanks.
> 
> My query is...
> 
> SELECT     COUNT(dbo.tbl_audit.update_stamp) AS ComplianceData,
> dbo.tbl_audit.fkFacilityId, dbo.tbl_facility.txtAgencyName,
> dbo.tbl_facility.name, 
>                       dbo.tbl_facility.id
> FROM         dbo.tbl_audit INNER JOIN
>                       dbo.tbl_facility ON dbo.tbl_audit.fkFacilityId =
> dbo.tbl_facility.id
> WHERE     (dbo.tbl_audit.update_stamp >= '20060201') AND
> (dbo.tbl_audit.update_stamp < '20060228') AND 
>                       (dbo.tbl_audit.update_stamp -
> CAST(FLOOR(CAST(dbo.tbl_audit.update_stamp AS float)) AS datetime)
> BETWEEN '00:00:00:000' AND '10:00:01:000')
> GROUP BY dbo.tbl_audit.fkFacilityId, dbo.tbl_facility.txtAgencyName,
> dbo.tbl_facility.name, dbo.tbl_facility.id
> 
> This returns the records starting at 1, showing me the "Agencies" that
> meet the criteria. How would grab and return the records that have a 0
> COUNT within the same query? I need to show the "Agencies" 
> that have not
> met the criteria as well.
> 
> TIA
> 
> 
> -- 
> 
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
> 
> For unsubscribe and other options, including the Tip Harvester 
> and archives of thelist go to: http://lists.evolt.org 
> Workers of the Web, evolt ! 
> 



More information about the thelist mailing list