How to do a SELECT pull qty or weight of sql to a single column on the grid depending on the register?

0

I have the following doubt, I created a stock table in sql for packaging and raw materials, with registration in the same form. I created one line for weight and another for qtde in sql. And I created a grid with a single column "qtde / weight" I want in a combobox selected by qtde or weight, look in the specific sql table and bring in the same column of the grid. But I can not do this select, can anyone help me?

    
asked by anonymous 02.06.2016 / 20:26

1 answer

0

If I understood your question and the following: You quoted depending on the register so I suppose you have some field informing the unit of that product. I do not know how the structure of your tables is ... but this should give you an idea of how it should be.

SELECT 
CODIGO,
DESCRICAO,
CASE PRODUTO.UNIDADE
     WHEN 'PESO' THEN PRODUTO.PESO
     WHEN 'QTDE' THEN PRODUTO.QTDE
     END AS QTDE_PESO


FROM PRODUTO
WHERE
//SUAS CONDICOES
    
02.06.2016 / 20:55