Toad World® Forums

Adding duplicated fields in Query Builder


#1

Hello,

I am trying to build a query in Query Builder, like:
select account, count(account) from General_Ledger group by account

The problem is that I cannot add the account field twice and apply the aggregate function ‘count’ to the second account field.
Query Builder apparently allows only one instance of a field. Is this right?
Of course, I can type the query but some people may want to create it visually, by drag and drop the account field twice, as in MS Access that does not have this limitation.

Is there any way to achieve this functionality?

Regards,
M.R. Message was edited by: mr2001

Message was edited by: mr2001


#2

You can achieve this by using a Calculated field. See screenshot. Press the tool button for the calcualted field editor. Provide a name for the column and press the +. Enter your count(account) and attach to a table. This will give you what you need.

debbie
CalcField.png


#3

Thanks Debbie, I see what you mean.
It’s however much more complicated than creating this kind of query in Access. The easiest thing would be to allow field duplication…

Regards,
M. R.

Message was edited by: mr2001