Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Convert Crystal query to SQL - Please help


  • Please log in to reply

#1
Wyattda

Wyattda

    New Member

  • Member
  • Pip
  • 3 posts
Hello,

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.

Thanks,
Wyatt
  • 0

Advertisements


#2
stu_design

stu_design

    Member

  • Member
  • PipPipPip
  • 217 posts
an idea

could u not go

(Calls.Time)<=[30]

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