Jako że jestem na początku drogi z SQL, mam pytanie w sprawie jednego zapytania:
Kod
select doc.doc_user_number As [Numer Umowy],product_doc.order_number As [Pozycja],product_doc.quantity As [Ilość sztuk],replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(product_doc.tag_production,'DRZ',''),'LAK',''),'POS',''),'NPR',''),'*',''),'HS',''),'HKS',''),'LUK',''),'SKOS',''),' ','') As [Tag]
,Production_line.production_line_type As [Linia],doc.doc_status_id As [Status Umowy],doc.doc_delivery_date As [Data wyjazdu], replace(replace(replace(replace(replace(replace(replace(replace(doc.tag_feature,'*1:',''),'*2:',' '),'MD',''),'AD',''),'ELEG',''),'88',''),'HS',''),'*','') As [Kolor]
from [PAM_TEST].dbo.doc
join dbo.doc_status on doc_status.id = doc.doc_status_id
join dbo.Production_line on Production_line.branch_id = doc.branch_id
join dbo.product_doc on product_doc.doc_id = doc.id
where product_doc.tag_production not like '' And doc.tag_feature not like '' And doc.tag_feature not like '%2K:%' And doc.tag_feature not like '%1S:%' And doc.doc_status_id = 7 And Production_line.production_line_type = -2
group by Production_line.production_line_type, doc.doc_user_number, doc.doc_status_id, doc.doc_delivery_date, doc.tag_feature,product_doc.tag_production, product_doc.order_number,product_doc.quantity
order by doc.doc_delivery_date asc
,Production_line.production_line_type As [Linia],doc.doc_status_id As [Status Umowy],doc.doc_delivery_date As [Data wyjazdu], replace(replace(replace(replace(replace(replace(replace(replace(doc.tag_feature,'*1:',''),'*2:',' '),'MD',''),'AD',''),'ELEG',''),'88',''),'HS',''),'*','') As [Kolor]
from [PAM_TEST].dbo.doc
join dbo.doc_status on doc_status.id = doc.doc_status_id
join dbo.Production_line on Production_line.branch_id = doc.branch_id
join dbo.product_doc on product_doc.doc_id = doc.id
where product_doc.tag_production not like '' And doc.tag_feature not like '' And doc.tag_feature not like '%2K:%' And doc.tag_feature not like '%1S:%' And doc.doc_status_id = 7 And Production_line.production_line_type = -2
group by Production_line.production_line_type, doc.doc_user_number, doc.doc_status_id, doc.doc_delivery_date, doc.tag_feature,product_doc.tag_production, product_doc.order_number,product_doc.quantity
order by doc.doc_delivery_date asc

Wszystko niby fajnie pokazuje, lecz pokazuje mi wartości puste z jednej kolumny mimo że rozgraniczyłem, żeby nie pokazywać. Proszę o doradzenie co robię źle.