Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.databases.ms-sqlserver > #1833

Re: adding a column to select

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail
From Erland Sommarskog <esquel@sommarskog.se>
Newsgroups comp.databases.ms-sqlserver
Subject Re: adding a column to select
Date Sat, 01 Nov 2014 15:06:32 +0100
Organization Erland Sommarskog
Lines 30
Message-ID <XnsA3D899B29DCC0Yazorman@127.0.0.1> (permalink)
References <74f6aa18-3f13-4af6-9664-9560eab46eff@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 8bit
Injection-Info mx02.eternal-september.org; posting-host="7e1b67d539bf738175a77c821bba24ba"; logging-data="21715"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Zbs1ZZsXW60D5zXmt1Lem"
User-Agent Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32)
Cancel-Lock sha1:P8Yzmd40AHSWk0PWjpa2DJO7XdE=
Xref csiph.com comp.databases.ms-sqlserver:1833

Show key headers only | View raw


Raul Rego (rrego@pmchnnj.org) writes:
> Can I go throiught all notes in toxnotes for casenumber = tp.casenumber
> and bundled them into one display 

You mean concatenate them to a single value? That can be achieved by 
using FOR XML PATH(''), but it is difficult to give you a query, because
I don't know what output more exactly you are looking for.

> full join UHCF hos on hos.UHCFNumber = tp.CallerSiteCode
> full join Codevalue cv_pa on cv_pa.CodeID = tp.patageunit
> full join CodeValue cv_ct  on cv_ct.CodeID = tp.calltype
> full join CodeValue cv_mo on cv_mo.CodeID = te.MedicalOutcome
> full join CodeValue cv_cs on cv_cs.CodeID = tp.CallerSite
> full join CodeValue cv_pt on cv_pt.CodeID = tp.PatGender
> full join CodeValue cv_cr on cv_cr.CodeID = tp.CallerRelToPat
> full join CodeValue cv_er on cv_er.CodeID = tp.ExpReason
> full join  CodeValue cv_es on cv_es.CodeID = tp.ExpSite
> full join CodeValue cv_ms on cv_ms.CodeID = te.ManagementSite

I don't think this is right. FULL JOIN is something you don't use very 
often. Probably you mean a LEFT JOIN for the columns in ToxPat which are
nullable.

-- 
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx

Back to comp.databases.ms-sqlserver | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

adding a column to select Raul Rego <rrego@pmchnnj.org> - 2014-10-31 10:47 -0700
  Re: adding a column to select Erland Sommarskog <esquel@sommarskog.se> - 2014-11-01 15:06 +0100
    Re: adding a column to select Raul Rego <rrego@pmchnnj.org> - 2014-11-03 05:13 -0800
      Re: adding a column to select Erland Sommarskog <esquel@sommarskog.se> - 2014-11-03 18:14 +0100
        Re: adding a column to select Ross Presser <rpresser@gmail.com> - 2014-11-03 09:56 -0800

csiph-web