Displaying only first row for the 2nd Stored procedure

I have two stored procedures in one report. My main stored procedure is procSSFTP_RPT_WorkAndRestDailyReport and 2nd stored procedure name is procSSFTP_RPT_GetCrewComments.

I want to display "Seafarer name" from my 1st stored procedure and "comments" from 2nd stored procedure.

I have multiple rows for the comments against the single seafarer name.

Instead of showing multiple rows of comments for single "seafarer name", I want to display one comment per "seafarer name".

Attached is the report for your reference

Sailee GovekarStudentAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Raghavendra HullurSoftware DeveloperCommented:
The details can be restricted to display only once for each Seafarer name and single comment (I think this will be the comment from the first record for each Seafarer) by displaying the details under Group header section by creating a group on seafarer name. But, you also have other details like Department and Rank. Will those also be constrained to a single row display for each Seafarer?
Or you just want to display all the records for each Seafarer name and display only the comment from first record for each Seafarer name?
Sailee GovekarStudentAuthor Commented:
We need to display top comment for each seafarer. Department and Rank will be single row.

Only the concern is with One seafarer and one comment.
Raghavendra HullurSoftware DeveloperCommented:
Something like in attached report will do. But, when you say top comment for each seafarer name, is it the first comment or is it something associate with some value? If so, you may have to change the details accordingly. Currently, in the modified report, first comment for each seafarer will be displayed.
Exploring SQL Server 2016: Fundamentals

Learn the fundamentals of Microsoft SQL Server, a relational database management system that stores and retrieves data when requested by other software applications.

Sailee GovekarStudentAuthor Commented:
No.. its not specific. The very first comment.

and if the comment is NULL then also the seafarer name should be displayed
Sailee GovekarStudentAuthor Commented:

I have multiple seafarer names. if I delete the comments then all the seafarer names are displayed.

If I add comments field then only on record is displayed. Which is wrong.

There will be list of seafarer
Raghavendra HullurSoftware DeveloperCommented:
That must be something to do with the link you have created between those 2 stored procs. Try changing the join from inner join to left outer or right outer join based on the data availability. You can use the report I shared (retain the comment field in the report) and check after changing the link join type.
Sailee GovekarStudentAuthor Commented:
Changing joins won't bring the correct data
Raghavendra HullurSoftware DeveloperCommented:
Unless you change, you will not be able to get all the Seafarer details, as the ones apart from "Espinosa, Reyland Arante" might not have comments.
Can you group by seafarer and display the information in the group header?
In that way only the first comment will be displayed.
To get it to work you need to change the join as mentioned.
Changing the join will work so long as you aren't filtering on the joined table


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Sailee GovekarStudentAuthor Commented:
It worked after changing the Joins.
Earlier we were facing some problems with the Joins so couldn't do it. But now introduced some relations to handle in Stored procedure.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.