cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
588
Views
0
Helpful
2
Replies

SQL query syntax for date range

j.mccartney
Level 1
Level 1

Hello, I'm trying to write a query against CUCM6.1.2 that will give me all calls made to an extension for an inclusive range of dates. I want to say give me all calls made to extension "Z" for an example between September 9th and October 1st.

Here is what I was thinking would do it but it didn't and I've tried a bunch of things with no success:

run sql select callingpartynumber, originalcalledpartynumber, finalcalledpartynumber, duration, datetimestamporigination, datetimestampdisconnect from car:tbl_billing_data where datetimestamporigination > '2009-09-10' and finalcalledpartynumber IN ('3321')

Thanks in advance.

John

2 Replies 2

Dennis Fogler
Cisco Employee
Cisco Employee

John,

You can certainly use the syntax

SELECT * FROM db_table

WHERE date >= "1-SEP-2009"

AND date <= "5-SEP-2009" as an example.

I usually use the BETWEEN command

SELECT * FROM db_table

WHERE date BETWEEN "1-SEP-2009"

AND "5-SEP-2009"

Thanks for the response, I tried what you listed and it didn't work. I tried modifying the syntax based on known working query's but still not having any luck. I'll keep on trying. Thanks again for helping.