Skip to content
Advertisement

SQL COUNT with condition and without – using JOIN

My goal is something like following table:

With two simple selects I could gain this values: (the key of the table consists of 3 columns [t$ncmp, t$trav, t$seqn])

How can I join these statements?

What I tried:

I tried different variantes, but always got errors like ‘group by is missing’ or ‘unknown qualifier’. Now this at least executes, but total is always 2.

If it matter, I will run this as an OPENQUERY from MSSQLSERVER to Oracle-DB.

Advertisement

Answer

I’d try

You typically GROUP BY the same columns as you SELECT – except those who are arguments to set functions.

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