I need help with SQL. I have a column in terminal and a column in table2 that match each other. (index) I want to display the count of terminals per index in table 'terminal', and merge it with table2 to include the index name in the output
select index,terminal=count(*) from terminal
group by index
returns
index terminal
--------- -----------
1 94
2 15
In table2 I have an index that matches the index in table 'terminal' and it also has the name that corresponds to the index.
Example:
select * from table2
Returns:
index name lcmid handle
------ ------ -------- --------
1 nameofindex1 8 10
2 nameofindex2 12 27
I want to count the number of terminals corresponding to the indexes in table 1 and then merge them to include the 'nameofindexes', lcmid and handle into the result. I apologize for sounding like a total newbie, but I'm learning as I go.
Any help is greatly appreciated.