Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: How to translate this SQL to CR? Post Reply Post New Topic
Author Message
Monkey
Newbie
Newbie


Joined: 20 Aug 2009
Location: United States
Online Status: Offline
Posts: 9
Quote Monkey Replybullet Topic: How to translate this SQL to CR?
     Posted: 24 Jun 2010 at 9:59am
Hi,
 
Programmer wrote the below query for me to run the report. I tried to convert it in the Crystal Report. But I do not have idea how to do the 'and'
& 'or' together in 'Select Expert' in CR?
 
SELECT * FROM TA_USER
WHERE emp_id IN (
SELECT distinct m.emp_id FROM
TA_TRANS_HISTORY T, TA_MASTER_HISTORY M
WHERE T.ta_id = M.ta_id
AND T.tc_id = 43
AND ((M.pay_period > 20 AND M.leave_year = 2009)
OR (M.pay_period <= 11 AND M.leave_year = 2010)
OR (M.pay_period = 20 AND M.leave_year = 2009
AND (t.day4 + t.day5 + t.day6 + t.day7 + t.day8 + t.day9 + t.day10 + t.day11 + t.day12 + t.day13) > 0 )))
 
Thanks for any help!
 
Monkey
 
IP IP Logged
kevlray
Admin Group
Admin Group
Avatar

Joined: 29 Oct 2009
Online Status: Offline
Posts: 1587
Quote kevlray Replybullet Posted: 25 Jun 2010 at 6:44am

You have to go to the formula editor in the Select Expert and do it there (Show Formula, Formula Editor).  Of course the fields will have to be in curly brackets. 

I see that you are doing a nested select statement, not sure how you will translate this into CR.
 
Of course, depending on what version of CR you are using, it might be better to use a 'Command'.
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum