How to create an effective Index with this query?

Create a field in sql query results?

  • i have two columns in a sql table that i need to perform math on (qty max - min onhand) during a query and display the calculated results in a field with the query results. i am using microsoft sql server management studio express to complete this. I have no clue how to create custom fields to query results.

  • Answer:

    SELECT ... qty_max - min_onhand AS MyField ...

Kevin K at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

The prev answer is basically correct, assuming that those are the actual field names. If you meant that they were the results of the MIN/MAX functions, then it'd be something along the lines of SELECT someID, MAX(qty) - MIN(onhand) AS "Weighted value" FROM someTable GROUP BY someID

Hey friend, I happen to know a really nice tool which solves SQL management problems and more. you should check it out. Cheers, Daniel

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.