0

I'm using DBISAM to have a table from existing datas.

My problem is :

NAME   |   COUNT(QTY)   |   PRICE    |    ?    | 
_______|________________|____________|_________|
  A    |       1        |    9.5     |   9.5   |
_______|________________|____________|_________|
  B    |       2        |    12.5    |   25    |
_______|________________|____________|_________|
  C    |       5        |    20      |   100   |
_______|________________|____________|_________|

My SQL request is SELECT NAME, COUNT(QTY), PRICE FROM ARTICLE. But I can't find how to have the last column (with the ?). I tried PRICE * COUNT(QTY) but DBISAM can't handle this and say "Invalid use of non-aggregated column".

Have you an idea about how I can get the last column ?

Thanks

BlackAlpha
  • 376
  • 1
  • 5
  • 15
  • You can just wrap this is an outer select. `SELECT col1, col2, col1 * col2 FROM (SELECT col1, col2 FROM tab1)`. I don't know DBISAM syntax specifically, but you'll likely need to alias your COUNT column. – Chris Hep Oct 05 '16 at 14:49
  • I don't believe any database can handle such a query. Plus you can't use the ? character as it is a reserved word. Why do you want to Count the QTY field instead of Sum it? – fullerm Feb 21 '17 at 23:22

0 Answers0