Abdulmajeed Alshari

Abdulmajeed Alshari

  • NA
  • 266
  • 61.3k

return multiple select from Different Tables in stored Proc

Feb 10 2018 9:04 AM
I write the below stored procedure but only show the columns in the first select statement when add stored procedure to crystal report ,I want make all select statements as a single select statement   :
 
  1. CREATE proc [dbo].[GetPublishedJobInfo]   
  2. @JobId int,@EmployerId nvarchar(128)  
  3. as   
  4. select logoImage ,CONVERT(DATE,GETDATE())  from EmployerInfoes where id=@EmployerId  
  5.   
  6. select jobName,PublishedDate ,  
  7. DATEDIFF(DD,DurationAvailableForApply,current_timestamp) - CASE WHEN  
  8. (MONTH(DurationAvailableForApply) > MONTH(current_timestamp)) OR (MONTH(DurationAvailableForApply) = MONTH(current_timestamp)  
  9. AND DAY(DurationAvailableForApply) > DAY(current_timestamp)) THEN 1 ELSE 0 END   
  10. from jobs where Id=@JobId  
  11.   
  12. select COUNT(*)  from ApplyForJobs  
  13. where JobId=@JobId  
  14.   
  15. select COUNT(*)  FROM JobViewNumbers  
  16. WHERE JobId=@JobId  
  17.   
  18. select PersonalPhotoImage , firstName+middleName+lastName  ,phoneNumber   
  19. , Email ,gender,country   
  20. from JobSeekerInfoes where id=(select UserId from ApplyForJobs where JobId=@JobId)  
  21.   
 

Answers (1)