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
 What's wrong with my syntax?

Author  Topic 

toocreepy
Starting Member

2 Posts

Posted - 2012-08-22 : 18:48:20
I'm trying to pull the number of page views for a set of documents over time. The query never fetches any results. Here's what I'm entering into Oracle SQL Developer:
SELECT DISTINCT COUNT(DOCUMENT_TITLE), DOCUMENT_ID, DOCUMENT_TITLE, TO_CHAR(EVENT_TIMESTAMP, 'MM/DD/YYYY') as RptDate
FROM
INSTUSER.DW_UEL_DOCVIEW
WHERE EVENT_TIMESTAMP > '07-AUG-12'
AND DOCUMENT_ID = ALL ('1254115' , '1266159' , '1271039' , '1272341' , '1281445' , '1283475' , '128589' , '1286771' , '1292519' , )
GROUP BY DOCUMENT_ID, DOCUMENT_TITLE, TO_CHAR(EVENT_TIMESTAMP, 'MM/DD/YYYY')
ORDER BY To_CHAR(EVENT_TIMESTAMP, 'MM/DD/YYYY') ASC


Anyone see anything wrong with that?

toocreepy
Starting Member

2 Posts

Posted - 2012-08-22 : 18:51:00
Sorry, this is my query:
SELECT DISTINCT COUNT(DOCUMENT_TITLE), DOCUMENT_ID, DOCUMENT_TITLE, TO_CHAR(EVENT_TIMESTAMP, 'MM/DD/YYYY') as RptDate
FROM
INSTUSER.DW_UEL_DOCVIEW
WHERE EVENT_TIMESTAMP > '07-AUG-12'
AND DOCUMENT_ID = ALL ('1002345' , '100435' , '1008175' , '1008215' , '1020655' , '994359' )
GROUP BY DOCUMENT_ID, DOCUMENT_TITLE, TO_CHAR(EVENT_TIMESTAMP, 'MM/DD/YYYY')
ORDER BY To_CHAR(EVENT_TIMESTAMP, 'MM/DD/YYYY') ASC
Go to Top of Page

bitsmed
Aged Yak Warrior

545 Posts

Posted - 2012-08-22 : 19:13:08
I'm not familiar with Oracle db, but it seems to me, the document_id in the where section will never come true, using the "= all".
I suggest you replace the "= all" with "in".

By the way, this is MSSQL db forum, so you will probable get more qualified help in an Oracle forum.
Go to Top of Page
   

- Advertisement -