×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

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

Inlude a formula in sql command

Inlude a formula in sql command

Inlude a formula in sql command

(OP)
Hi,

Using Crystal report 2011
I need to link two views by one field. The field type however is different in both views, so I am not able to link them.

I have VWSCHEDULEVOLUNTEER.VOLUNTEER_KEY with numbers from 1 to ...
I have VWSRVOLUNTEERDEMOGRAPHICS with strings like VRN-1 to VRN-...

I never used sql commands as I don't really know how to write them. But would it be possible adding below formula

VRN = "VRN-"& cstr({VWSCHEDULEVOLUNTEERSTUDY.VOLUNTEER_KEY},0,"","")

to below command so that I could link these fields?

SELECT
"VWSCHEDULEVOLUNTEERSTUDY"."VOLUNTEER_KEY"

FROM
"LABPAS"."VWSCHEDULEVOLUNTEERSTUDY"

Thanks,
Nils

RE: Inlude a formula in sql command

You can create another view in the database and join the existing views. In SQLServer the new view will look like this:

SELECT ....
FROM view1 v1
INNER JOIN view2 v2 ON v1.Key = 'VRN-' + CONVERT(varchar(100),v2.Key)

If you do not have permissions to create a view inside the database you can create a command using the same SQL and base your report on it.

www.R-Tag.com Viewer and Scheduler for Crystal reports, SSRS and Dynamic Dashboards.

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