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 |
casati74
Posting Yak Master
109 Posts |
Posted - 2006-09-01 : 10:40:16
|
Hello, it possible, and if it's possible how, to write a select for retrive information using another select how from statement???es:select * from (select miatabella from nomitabelle where id =1)where desc='prova'It's possible???? |
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-09-01 : 10:45:10
|
Yes - it's called a derived table. You just have to give it an alias and include the columns referencedselect * from (select miatabella, desc from nomitabelle where id =1) awhere desc='prova'==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-09-01 : 10:46:51
|
yes, this is called derived table. In the example you gave, field Desc must be present in the inner query then only you can refer it in the outer query, like this..select * from (select miatabella,desc from nomitabelle where id =1)where desc='prova' Harsh AthalyeIndia."Nothing is Impossible" |
|
|
casati74
Posting Yak Master
109 Posts |
Posted - 2006-09-01 : 10:49:14
|
Thank's a lot!!!!!!!!!!!!!!!!!!! |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-09-02 : 10:13:42
|
quote: Originally posted by harsh_athalye yes, this is called derived table. In the example you gave, field Desc must be present in the inner query then only you can refer it in the outer query, like this..select * from (select miatabella,desc from nomitabelle where id =1)where desc='prova' Harsh AthalyeIndia."Nothing is Impossible"
Also, You need to use Alias for derived table. Refer Nigel's queryMadhivananFailing to plan is Planning to fail |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2006-09-02 : 10:28:14
|
quote: Originally posted by madhivananAlso, You need to use Alias for derived table. Refer Nigel's queryMadhivananFailing to plan is Planning to fail
Oops!!!Yeah, I just missed it, Thanks Madhivanan !!Harsh AthalyeIndia."Nothing is Impossible" |
|
|
|
|
|
|
|