Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
RyanKashi
Starting Member
4 Posts |
Posted - 2012-04-19 : 13:51:07
|
| I am trying to use subqueries to make a query that displays FirstName from the Students table, ClassName from the Classes table, AssignDescription from the Assignments table, and Score from the Results table.Here is the relationship tablehttp://imageshack.us/photo/my-images/848/relationshipsdia.jpg/thank you very much |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-19 : 14:12:13
|
| no need of subqueries. you can simply join them using related columns to get your result. You need to use LEFT or INNER JOIN based on whether you want only matching entries or all entries from Students table------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
RyanKashi
Starting Member
4 Posts |
Posted - 2012-04-19 : 14:20:20
|
| I figured that out, but is there anyway I could display just those 4 pieces of information using sub queries? |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-19 : 14:22:15
|
| hmm...why do you still need subqueries? its possible------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
RyanKashi
Starting Member
4 Posts |
Posted - 2012-04-19 : 14:29:36
|
| I am trying to figure out how to use them for future use based off of this example. I have read several websites and still cannot grasp the concept -_- |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-19 : 14:44:46
|
| you can use it but only thing is you need to repeat subquery for each column you need to retrieve from other tables and also it performs poorly when data involved is large------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
RyanKashi
Starting Member
4 Posts |
Posted - 2012-04-19 : 14:48:46
|
| can you type out an example for me of this? It does not necessarily have to be my original question, but if i saw an example I would most likely understand it better. Thanks |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2012-04-19 : 14:52:44
|
| i cant view diagram here. can you post in here in words------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|