Grid help

Hello I have a table where I show the items as the category.
SELECT
item, description, price, codfamilia

FROM
article

If a client has logged led him to another table:

SELECT
codcli, codfamilia, article, discount, price
FROM
rates
WHERE
(codcli = ‘[v_codcli]’) AND (codart = ‘{codart}’)

Then I put the conditions

If the field is NULL codfamilia field and is equal to codart article makes me a discount on the price.

if (dataset {[0] [1]} = “NULL” and {dataset [0] [2]} = “160000000013”) {

  $importedto dataset = {[0] [4]} * {dataset [0] [3]} / 100; // If the field is NULL codfam does tpcdes prevention

{price} = {dataset [0] [4]} - $importedto;

So far I more or less does the problem that arises is me:

I want to do that if the article codfamilia table is equal to all items of the article table makes me a discount rates codfamilia table, respecting those who have found the article in the rates table?
customerid article codfamilia discount price
1 NULL 160 000 000 013 25.00 55,000 (this would be the first condition)
1 15.00 16000 NULL NULL (here would have to apply the 15% discount for the whole family “16000” table items excluding the article “160000000013”

Thank you very much, hope I explained.

Answered in spanish post.

That’s a pitty as most of us are English and might be interested in the solutions…

I answered about he is not focusing in the right way. Take data with querys and save in vars,and then do the calcs,basically.

Albert,learn Spanish,if not,when comes to our sunny city,we will not understand between us taking beers.

I think I can manage with my limited Portugues: Bom dia, quero um cerveja faz favor. …

I don’t think it will be of much difference in Spanish. I don’t think I would need the IT blahblah in spanish :wink:

Boa sorte!