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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2005-12-21 : 09:47:54
|
| Imran writes "Hello thereThis is Imran, will pray for you if u help me out with this problemI have 2 tablesDevelopments------------->DevelopmentId - AutoNum ProjectNameDevelopment_Pictures--------------------->Auto DevelopmentId PicName PicTypeThe two tables are linked by DevelopmentId. Each record in developments can have many related records in Development_Pictures.Now i want all records from Developmentsalong with the PicName. The thing is that only to showpicName where the PicType is 'Big'ProjectName, PicName Thank Youwhere the " |
|
|
Srinika
Master Smack Fu Yak Hacker
1378 Posts |
Posted - 2005-12-21 : 11:29:44
|
| Hi Imran,I think better to learn some Basic SQL than pray for me !!Select * from DevelopmentsWhere DevelopmentId in(Select DevelopmentId from Development_Pictures where PicType = 'Big') |
 |
|
|
ditch
Master Smack Fu Yak Hacker
1466 Posts |
Posted - 2005-12-21 : 12:58:30
|
Why the sub query?Hi Imran,Pray that you don't ever use expensive sub querires where you don't have to:SELECT d.*, p.PicName FROM Developments d INNER JOIN Development_Pictures p on d.DevelopmentID = p.DevelopmentID WHERE p.PicType = 'Big'Duane. "It's a thankless job, but I've got a lot of Karma to burn off." |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-12-22 : 01:06:54
|
| Learn SQL basicshttp://www.firstsql.com/tutor.htm http://www.w3schools.com/sql/default.aspMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|