0 - 1 of 1 tags for select specific columns

Hello,

I have been struggling with this concept and any help would be highly appreciated. Do we need a stored procedure here? here is a small mock up example, however this will be implemented on a large scale.

Table 1