Avatar of gnoled1
gnoled1Flag for United States of America

asked on 

SQL Command - CR XI

I have an SQL Command which joins multiple tables and finds the effective recruiter using an embedded select statement.  I would like to look up that recruiter code in another table to get their actual name (last and first).  Would this be done as part of the SQL Command or directly through the report writer?  (See SQL Command attached)

The actual name resides in the tbl_employee table where the recrutier_code is tbl_employee.code.
select collection_Code, 
           collection_date, 
           gl.group_location_id, 
           cgr.projected_donors, 
           cgr.scheduled_donors,
	    recruiter_code = (select Top (1) recruiter_code from group_location_recruiter 
						where group_location_id = gl.group_location_id and 
                                                effective_date <= cg.collection_date order by effective_date DESC),
           cv.vehicle_code
	from collection_General cg Join collection_groups cgr 
	on cg.collection_id = cgr.collection_id
        Join collection_vehicles cv on cg.collection_id = cv.collection_id
	Join group_location gl on gl.group_location_id = cgr.group_location_id
Order By collection_code

Open in new window

Crystal Reports

Avatar of undefined
Last Comment
gnoled1
Avatar of KMusatoff
KMusatoff

this would be a very dirty way...
firstName = (select first_name from tbl_employee where code = (select Top (1) recruiter_code from group_location_recruiter where group_location_id = gl.group_location_id and  effective_date <= cg.collection_date order by effective_date DESC))

Open in new window

Avatar of gnoled1
gnoled1
Flag of United States of America image

ASKER

I thought of this but feel like there must be a better way.  Maybe some way to look up the code once the results are in CR?
ASKER CERTIFIED SOLUTION
Avatar of Sharath S
Sharath S
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of gnoled1
gnoled1
Flag of United States of America image

ASKER

Thank you.  I knew there had to be a better way.
Crystal Reports
Crystal Reports

Crystal Reports is a business intelligence application from SAP SE. It is used to graphically design data connections and report layouts from a wide range of data sources including Excel spreadsheets, Oracle, SQL Server databases and Access databases, BusinessObjects Enterprise business views, and local file-system information. Report designers can place fields from these sources on the report design surface, and can also deploy them in custom formulas (using either BASIC or Crystal's own syntax), which are then placed on the design surface. Crystal Reports also supports subreports, graphing, and a limited amount of GIS functionality.

36K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo