Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

SQL and Crystal Reports

SQL and Crystal Reports

SQL and Crystal Reports

I am trying to have the following MSSQL 7 query show up in Crystal Reports:

select t.territory_name, c.company_name, co.city
from company c, contact co, territory t
where c.company_id = co.company_id
and co.territory_id = t.territory_id
and co.priority = '2A'
and co.date_2a >= '2001-04-20' and co.date_2a < '2001-04-22'
and ((co.date_2a >= isnull(co.date_1a, '2001-04-20')) and
    (co.date_2a >= isnull(co.date_1b, '2001-04-20')) and
    (co.date_2a >= isnull(co.date_2b, '2001-04-20')) and
    (co.date_2a >= isnull(co.date_3a, '2001-04-20')) and
    (co.date_2a >= isnull(co.date_3b, '2001-04-20')) and
    (co.date_2a >= isnull(co.date_3c, '2001-04-20')) and
    (co.date_2a >= isnull(co.date_3d, '2001-04-20')) and
    (co.date_2a >= isnull(co.date_3v, '2001-04-20')))
order by co.date_2a desc

I can set "co.date_2a >= co.date_Xy" just fine.  It's just that the isnull function in MSSQL server does not work the same way in Crystal Reports.  Can anybody offer any suggestions on how I could put the above query in Crystal Reports?  Any help will be greatly appreciated.  Thanks!

RE: SQL and Crystal Reports

You could edit the SQL statement directly, but you would have to change your syntax to standard ANSI SQL.  
Or you could add a record selection statement in the form of
If IsNull({co.date_1a}) then
  {co.date_2a} >= Date(2001,4,20)
  {co.date_2a} >= {co.date_1a}
) and...

Malcolm Wynden
Authorized Crystal Engineer

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close