🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.databases.mssql-l
Article #2098

Re: Building SQL Query???

#2098
From: Larry Barkey
Date: Mon, 10 Apr 1995 00:00
20 lines
1052 bytes
With regard to trying to get to:

> ====================================
> FIELDA       FIELDB       FIELDC
> ====================================
> B             100          150
> C             210          350
> D             145           0
> ====================================
> 

If col2 is an int or numeric, try something like:

select col1,
       SUM(col3 * (1 - sign(abs(col2 - 1)))),
       SUM(col3 * (1 - sign(abs(col2 - 2))))
group by col1

I'm afraid I didn't have time to try this but I hope it helps.
Larry
Technical Details
Message-ID: <3mc4qm$jhg@spruce.citicorp.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <jtmurrayD6GtKv.E8C@netcom.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 108a70,2f52e0a1fb0e2fbd
X-Google-Attributes: gid108a70,public
X-Google-Thread: f6611,2f52e0a1fb0e2fbd
X-Google-Attributes: gidf6611,public
From: Larry Barkey <larry.barkey@citicorp.com>
Subject: Re: Building SQL Query???
Date: 1995/04/10
Message-ID: <3mc4qm$jhg@spruce.citicorp.com>
X-Deja-AN: 100189451
references: <jtmurrayD6GtKv.E8C@netcom.com>
organization: Citicorp - CGIN
newsgroups: bit.databases.mssql-l,comp.databases.sybase