Jump to content

Welcome to Geeks to Go - Register now for FREE

Need help with your computer or device? Want to learn new tech skills? You're in the right place!
Geeks to Go is a friendly community of tech experts who can solve any problem you have. Just create a free account and post your question. Our volunteers will reply quickly and guide you through the steps. Don't let tech troubles stop you. Join Geeks to Go now and get the support you need!

How it Works Create Account

Convert Crystal query to SQL - Please help

  • Please log in to reply



    New Member

  • Member
  • Pip
  • 3 posts

I've created a query in Crystal and need to convert it to SQL to be run in a VB6 application. The query is as follows:

if {Calls.Date} = {Calls.DateReceived} and {Calls.Date} = Calls.DateTaken} and {Calls.TimeTaken}<>{Calls.Time} and
datediff("n",{Calls.Time},{Calls.DateReceived})>=.5 and
datediff("n",{Calls.Time},{Calls.TimeTaken}) <= 30

This Crystal query gives me the number of calls taken within the first half hour. Now in SQL i'm not sure how to get the datediff part of the query to work. This is what I have so far:

SELECT Calls.Date, Calls.DateReceived, Calls.DateTaken, Calls.Time, Calls.TimeTaken
FROM Calls
WHERE (((Calls.Date)=[DateReceived]) AND ((Calls.DateReceived)=Date()) AND ((Calls.DateTaken)=[Date]) AND ((Calls.Time)<>[TimeTaken]) AND ((Calls.TimeTaken)=[Calls]![Time] And (Calls.TimeTaken)=[Calls]![TimeTaken]));

As you can see there is no time comparison to get calls within the first 30 mins the call was taken.

Any help getting datediff("n",{Calls.Time},{Calls.DateReceived})>=.5 and
datediff("n",{Calls.Time},{Calls.TimeTaken}) <= 30 converted to SQL would be great.

  • 0





  • Member
  • PipPipPip
  • 217 posts
an idea

could u not go


im not really good at SQL learning slowly hto

just an idea

Stu design
  • 0

Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP