Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to get id

Author  Topic 

cctv_sara
Starting Member

1 Post

Posted - 2010-12-09 : 05:42:18

I need your assistance in getting the following from the script.

This line in the script

WHERE e2.[ReaderID] IN ( 130,131,133,134 ) -- This is the list of readers you need a report on

Instead of getting the details from this readers, I need to get it from all the readers.
THE SCRIPT


SELECT e.[EventID]

,e.[UTCDateTime]

,e.[UTCOffset]

,e.[IDHolderID]

,e.[IdentifierID]

,e.[ReaderID]

,r.[Reader]

,idh.[Firstname]

,idh.[Surname]

,iden.Identifier

,uf.[Text] AS EMP_NO

FROM [StarWatch].[StarWatchViews].[Event2] e

JOIN [StarWatch].[StarWatchViews].[Reader] r

ON e.[readerid] = r.[readerid]

JOIN [StarWatch].[StarWatchViews].[IDHolder] idh

ON e.[IDHolderID] = idh.[IDHolderID]

JOIN [StarWatch].[StarWatchViews].[Identifier] iden

ON e.[IdentifierID] = iden.IdentifierID

LEFT OUTER JOIN [StarWatch].[StarWatchViews].[IDHolderTextFieldAssignedToIDHolder] UF
ON e.[IDHolderID] = UF.IDHolderID AND UF.FieldID = 16

WHERE e.[eventID] in (

SELECT e2.[EventID] FROM [StarWatch].[StarWatchViews].[Event2] e2

WHERE e2.[ReaderID] IN ( 130,131,133,134 ) -- This is the list of readers you need a report on

)

AND e.[XmlData].value('(//Event)[1]/@AEv','int') = 0 -- This is valid access

and e.[UTCDateTime] between '01-oct-10' and '31-oct-10'

ORDER BY e.[UTCDateTime]


Sachin.Nand

2937 Posts

Posted - 2010-12-09 : 05:55:16
Remove the where clause.

PBUH

Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-12-09 : 05:59:46
[code]
WHERE e.[XmlData].value('(//Event)[1]/@AEv','int') = 0 -- This is valid access
and e.[UTCDateTime] between '01-oct-10' and '31-oct-10'
ORDER BY e.[UTCDateTime]
[/code]


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -