Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Choosing a column based on a prompt? 1

Status
Not open for further replies.

RktScientist

Programmer
Mar 19, 2002
1
US
I have a database that keeps information for every month for one year in a different column.

ex Year Jan Feb Mar etc
2000 1000 50 200

Does anyone know a what that i can call the months dynamically? I need to have one report for a given year and any month (which i'd like the user to select instead of doing 12 reports).
 
You could create an object, say 'selectable month' with sql similar to this...


case @prompt('Select month','A',,,)
when 'Jan' then column_jan
when 'Feb' then column_feb
when 'Mar' then column_mar
...
else 0 -- bad selection
end

Of course a prompt of fixed list values would be better..

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top