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

SalesProfitDB2c : 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 "salesprofit.inc". It also illustrates
how to break a line in a query statement.

   Files:  Sample.mdb  SalesProfitDB2c.gms
$ontext Example database access with MDB2GMS The programs selects sales and profit information from database "Sample.mdb" using 'UNION' and writes results to "salesprofit.inc". It also illustrates how to break a line in a query statement. $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=salesprofit.inc $offecho $call =mdb2gms @cmd.txt parameter data(prd,loc,y,q) / $include salesprofit.inc /; display data;