user1529419 user1529419 - 2 years ago 63
SQL Question

Display value of second gridview from first gridview

I have a table:


id (int)
totalDimension (double)
usedDimension (double)

and on an aspx page I have a gridview that bind to this table by using:

Select id, (totalDimension- usedDimension) AS available From Box;

enter image description here

When the user clicks "select" of a particular row of the gridview, another gridview would appear and show other box that have usedDimension lesser than the available space.

Example if the user select ID 1, the second gridview would show all the other boxes that have usedDimension below 5000:

enter image description here

And my question is that is it possible to use SQL to achieve that? By using a subquery?

Answer Source

Yes, it is possible. You are able to use where clause:

Select id, (totalDimension - usedDimension) AS available From Box where (totalDimension - usedDimension) < @somevalue
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download