(Hi there, not entirely sure if this is the right place to ask, sorry if it isn't!)

I am knocking up a fairly quick and dirty Visual Basic.NET application that essentially is a DB UI for my day job, and I have run into a problem I can't quite figure out.

I am essentially storing items, suppliers, and pricing in three separate MySQL tables. I can access them fine, I fill relevant tables with an Adapter, and can iterate through the rows okay. So far so good.

The difficulty I'm having is that I want to eliminate some pricing rows from the DataTable conditionally. Here's the thing:

Each pricing entry has a width and a length attribute, because these items are made to size on order. Think like a piece of paper that is cut to a certain size, letter, legal, etc. That's the basic thing. So each pricing entry is "this supplier offers this size for this price" And they may also have price breaks.

So for example:

  • Supplier A has 500 8.5x11 for 10$
  • Supplier B has 100 8.5x11 for 20$
  • Supplier B has 1000 8.5x11 for 45$

For the current display I am working on, I want to be able to JUST display which of the two would be the cheapest cost per unit, and eliminate other rows.

How would I achieve this without adding a cost per unit entry to the database table? There's other considerations that would affect the cost per unit which are stored or computer elsewhere (shipping costs, free shipping if over a certain cost, etc), so I don't want to resort to having a CPU column in the database/datatable if I don't have to.

  • Your question is a little bit unclear - without telling the precise columns you have in your tables, it is hard to give you an answer in terms of those columns. Regardless of this, what is hindering you from querying the data you need and calculate values like cost-per-unit in your VB.NET application, without storing it in a db table? – Doc Brown Nov 17 '18 at 22:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.