How to do a SELECT pull Qtde or sql weight to a single column on the grid depending on registration?

Asked

Viewed 106 times

0

I have the following question, I created a stock table in sql for packaging and raw materials, with registration in the same form. I created a line for weight and another for Qtde in sql. And I created a grid with a single column "Qtde/weight" I want that in a combobox selected by Qtde or weight, look in the specific table of sql and bring in the same column of the grid. Only I can’t make that select, someone can help me ?

  • From what I understand you only need to get the two values, qtde and peso, and concatenate them the way you prefer. You use some framework to access the database or use sql pure? If it is sql pure, what is the database of your application?

  • sql , and I want to either pull weight or Qtde , depending on the specification of the combobox (weight or Qtde). I don’t want to join them.

1 answer

0


If I understood your question and the following: You quoted depending on the registration so I guess there is some field informing the unit of this product. I don’t know what the structure of your tables looks like... but that 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
  • thank you very much

Browser other questions tagged

You are not signed in. Login or sign up in order to post.