Unanswered: How to make one Issue to show max of only three solutions
Am new to database concepts and trying to learn on own with few ebooks. I have created two tables one table as Issues (It has issue id as PK and title as columns) and another table as Solutions (It has solution id as PK, solution, issue id as FK columns).
Tables are created with columns but now my question is:
Each issue will have more than one solution but I want to display only top three solutions for each issue. So how can I achieve this?
Any help is really appreciated.
Please let me know if You need any additional inputs.
Based on sample data you provided in the third image, it appears that "top 3" is based on the first character so the following code might do the job:
... where substr(recmn, 1, 1) <= 3
If there are recommendations that have two-digit numbers (such as 10, 11, ...), then this would be a better idea:
... where to_number(regexp_substr(col, '^\d+')) <= 3
However, I think that - if you chose to use such a model - you'd better split "recommendation" string into two columns: one which would contain the ranking number (1, 2, 3, ...), and another one which contains description. In that case, you'd simply