SQL Server 2005
I have data in 3 tables – Sopa, SopaProjectType and ProjectType.
Sopa table contains the information about jobs. Each job may be without any type assigned, may have just one type assigned or may have more than one type assigned.
I would ask you to write a stored procedure which will give all jobs (distinct, one job must be presented ones in the return) with their types: If no job type was assigned to the job then the field has an empty string, if just one type was assigned then the field JobType has to have the Job Type taken from ProjectType table, and if more than ONE type was assigned to the job then there should be just the word MULTIPLE.
I populated the table _RequiredResult with the data I created manually, The stored procedure you create must return exact the same data as you see in the table. The stored procedure must be compatible with SQL Server 2005 and later. So, do not use any features existing in newer than 2005 versions.
I attached the database which was created in SQL Server 2008. Do not ask me to give you the script for the database or any other materials.
If the field RowDeleted = True in Sopa or SopaProjectType then that row should be excluded. If the field RowDeleted = True in the ProjectType table then depending on the number of assigned Project Types the returned Project Type should have the value as the row with RowDeleted = True doesn' exist at all.
20 freelancers are bidding on average $42 for this job
Hi vladich, I am glad to help you to create the stored procedure. There was a question regarding the database file you provided, please check the PMB for my additional question. Sincerely yours, John
hi vladich! I'm an expert coder and sql administrator. This procedure will be no problem. You will get the results exactly as in your example, fast and accurate! Thanks!