在where子句和内连接中使用select

时间:2017-01-21 09:22:44

标签: inner-join

我有树桌:

1。 项目

itm_code,itm_gsm,itm_size

2。 LotMaster

lot_code,itm_code,po_number,lot_number

3。 LotItems

lot_itm_code,lot_code,lot_itm_qty

如何获取po_number和lot_number的用户输入值的itm_gsm,itm_qty,lot_itm_qty?

1 个答案:

答案 0 :(得分:0)

试试这个:

select itm.Itm_gsm,itm.itm_qty ltm.lot_itm_qty from Items itm inner join LotMaster lm on lm.itm_code=itm.itm_code inner join LotItems ltm on ltm.lot_code=lm.lot_code where lm.po_number=@po_number and lm.lot_number=@lot_number;