Information générale
Forum:
Microsoft SQL Server
Titre:
Single Row for SQL Union
Hello,
I have some SQL that is:
select proread.la_idla,usertab.us_desc as desc1, '' as desc2
from proread, usertab
where proread.pr_inttype=usertab.us_code and usertab.us_type='IT'
union
select proread.la_idla,'',usertab.us_desc
from proread, usertab
where proread.pr_type=usertab.us_code and usertab.us_type='RE'
This does return the correct rows. However, there are 2 rows per la_idla. I would like there to be a single row for each la_idla field, with desc1 and desc2 appearing on the same row.
Hopefully there is a simple way in which to do this, but it escapes me at present.
Any help?
Pete
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement