Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 accessing data created by select case statements

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-01-17 : 17:53:41
Jon writes "consider the following statement:

SELECT month =
CASE type
WHEN '1' THEN 'Jan'
WHEN '2' THEN 'Feb'
WHEN '3' THEN 'Mar'
END,
sum (quantity * price) as total
from sales_table
order by month

will return something like

month sum
-----------
Jan 100
Feb 200
Mar 300

in query analyser.


If I opened the connection using an ado connection in VB, i.e.
adors1.open " SELECT month = case....."
how can i access the different rows in the returned results??
if i use adors1!month, it will return Jan
if i use adors1!sum, it will return 100
(basically the first row of results)

how can i get the sum for when month = mar for example?"
   

- Advertisement -