sql server - I need to join two tables to get all the records from the student_info table -


i need join 2 tables records student_info table , records student_activities table student_id's equal.

as there can multiple records in student activities table single student_id i'm getting duplicates when print output using left join.

select * student_info  left join student_activities  on student_info.student_id=student_activities.student _id 

it suggested use following errors saying specific fields not part of aggregate function.

select student_info.student_id, student_info.student_name, student_info.phone, student_info.age, count (student_activities.student_id) coa student_info  left outer join student_activities  on student_info.student_id=student_activities.student_id  group student_info.student_id 

  select student_info.student_id, student_info.student_name, student_info.phone, student_info.age, isnull(t.coa, 0) coa     student_info   left   join (select student_id, count(*) coa student_activities group student_id) t   on     student_info.student_id = t.student_id 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -