How to fetch records from a One to Many relationship table.
eg: wanna get details of all orders for a specific customer.
(do not want repeatation of master table records for child
table records)
Answer Posted / syeda
Need to define a relationship to the table and common column
of tables
ex : there is a table called college which contains the
college records like studid, studentname, batch & course.
And other table called student_details which contains
studid, firstName, lastName, fathersName, mothersName, DOB,
ContactNo & address.
Here we are fetching studid, batch, course & studentname
from collete table and DOB, ContactNo & address from
students_details , of all the students whose birth month is
April 1988
Syntax : select
a.studid,a.batch,a.course,a.studentname,b.DOB,b.ContactNo,b.address
from college a, student_details b where a.studid=b.studid
and b.DOB like '%-Apr-1988'
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
When a primary key constraint is included in a table, what other constraints does this imply?
How to truncate the log in sql server 2012? : sql server database administration
Why use stored procedures in sql server?
What is the purpose of sql profiler in sql server? : sql server database administration
What is read uncmmited?
What program is used to store the data source file?
Can a synonym name of a table be used instead of a table name in a select statement?
What are exact numeric data types in ms sql server?
Explain what is dbcc?
What is an index in sql?
Tell me what are the essential components of sql server service broker?
How sql server enhances scalability of the database system?
How to rename an existing column with sql server management studio?
What is recompile sql server?
Write a Select Query to display title for each group of records, which are collected with Compute Clause? Like titlefield column-A column-B ..... ..... ..... Sum ... titlefield column-A column-B ..... ..... ..... Sum ...