Skip to content
Advertisement

How can I calculate a percentage from values obtained by 2 different queries in SSMS?

First query:

Second query:

Advertisement

Answer

You can do conditional aggregation. Unless there are null values in eupdate and eproj, I would recommend avg()

If you really need to deal with nulls:

I removed the single quotes around eid, because it looks like a number; if it’s really a string, then you can revert that change.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement