GAMS [ Home | Support | Sales | Solvers | Documentation | Model Libraries | Search | Contact Us ]

SalesProfitDB2m : Use of UNION to read multi-data column tables


Example database access with MDB2GMS
The programs selects sales and profit information from database "Sample.mdb"
using 'UNION' and writes results to "salesprofitm.inc". It also illustrates
use 'M' (mute) to remove messages to stdout and advertisement in generated include file.

   Files:  Sample.mdb  SalesProfitDB2m.gms
$ontext Example database access with MDB2GMS The programs selects sales and profit information from database "Sample.mdb" using 'UNION' and writes results to "salesprofitm.inc". It also illustrates use 'M' (mute) to remove messages to stdout and advertisement in generated include file. $offtext set y 'years' /1997*1998/; set loc 'locations' /nyc,was,la,sfo/; set prd 'products' /hardware, software/; set q 'quantities' /sales, profit/; $onecho > cmd.txt I=Sample.mdb Q=select prod,loc,year,'sales',sales from data union select prod,loc,year,'profit',profit from data O=salesprofitm.inc M $offecho $call =mdb2gms @cmd.txt parameter data(prd,loc,y,q) / $include salesprofitm.inc /; display data;