Article View: bit.databases.mssql-l
Article #2005Building SQL Query???
From: john murray
Date: Mon, 03 Apr 1995 00:00
Date: Mon, 03 Apr 1995 00:00
41 lines
1957 bytes
1957 bytes
Pardon me for sounding like a newbie here, but I am really stuck
with trying to write a SQL statement (listed below). I am trying to do
this in C++ currently to go against a MSSQL Server so I am stuck (as far
as I know with Transact). If someone has other suggestions as to another
product that would give me additional ability with my SQL statements, I
would be more than all ears..as it were. Many TIAs for anyone that could
help or provide guidance on this.
================
Using Transact SQL, I need to return a table like this:
====================================
FIELDA FIELDB FIELDC
====================================
B 100 150
C 210 350
D 145 0
====================================
from a table similar to the one listed below. This selects the
value of Col1 and provides the sum of Col3 into either FieldB or FieldC
based on the value of Col2 (i.e. if Col2 is 1 then the Sum of Col3 into
fieldB...etc..)
Table...
===============================
Col1 Col2 Col3
===============================
B 1 100
B 2 150
C 1 210
C 2 350
D 1 145
===============================
John Murray
jmurray@dnasunnet.dna.mci.com
Technical Details
Message-ID:
<jtmurrayD6GtKv.E8C@netcom.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 108a70,2f52e0a1fb0e2fbd,start X-Google-Attributes: gid108a70,public X-Google-Thread: f6611,2f52e0a1fb0e2fbd,start X-Google-Attributes: gidf6611,public From: jtmurray@netcom.com (john murray) Subject: Building SQL Query??? Date: 1995/04/03 Message-ID: <jtmurrayD6GtKv.E8C@netcom.com> X-Deja-AN: 100811833 sender: jtmurray@netcom20.netcom.com organization: NETCOM On-line Communication Services (408 261-4700 guest) newsgroups: bit.databases.mssql-l,comp.databases.sybase