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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic query

Status
Not open for further replies.

Edno

Programmer
Apr 19, 2006
5
FR
Hi,

I use CR 8.0, i'd like to perform a query like :

SELECT
sum(D.QTE_STOCK) as QTE_PALETTE, (FLOOR((<?NbDrums>+rang-1)/<?NbDrums>)) as PALETTE, C.*
FROM
(select (select count(i.ID_CONTENANT)
from PHARMSTAR.dbo.CONTENANT i
where i.ID_CONTENANT <= o.ID_CONTENANT) as rang,
ID_LOT, QTE_STOCK
from PHARMSTAR.dbo.CONTENANT o) as D,
(SELECT * FROM
(select ID_LOT,
LIB_ARTICLE,
CODE_ARTICLE
from PHARMSTAR.dbo.LOT LOT,
PHARMSTAR.dbo.ARTICLE ARTICLE
where LOT.ID_ARTICLE = ARTICLE.ID_ARTICLE) as A,
(select LOT.*,
PROD.DATE_FAB
from LOT,
PHARMSTAR.dbo.EP EP,
PHARMSTAR.dbo.PROD PROD
where LOT.ID_EP = EP.ID_EP
and EP.ID_PROD = PROD.ID_PROD
and LOT.NUM_LOT = <?MyBatch>) as B
WHERE A.ID_LOT=B.ID_LOT) as C
WHERE
D.ID_LOT=C.ID_LOT
GROUP BY (FLOOR((<?NbDrums>+rang-1)/<?NbDrums>))

where <?NbDrums> et <?MyBatch> will be parameters.

But i'm not able to change the columns selected in the query. So is it possible to perform such query ? Or do i use a less restrictive query as data source and perfoming formula on for extracting and calculating data ?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top