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 |
|
Phibian
Starting Member
32 Posts |
Posted - 2002-05-21 : 18:08:19
|
| Okay, I have a subquery that returns a value by which I'd like to sort.Eg.SELECT X (SELECT X FROM Table1 WHERE Condition set 1) AS Y,FROM Table2WHERE Condition set 2I've tried all kinds of things, but I can't order by Y. I'm obviously missing something.Thanks |
|
|
jbkayne
Posting Yak Master
100 Posts |
Posted - 2002-05-21 : 18:31:26
|
| I wrote an example that may help you...I assume you want a correlated subquery since a regular subquery would not vary from row to row (wouldn't make sense for sorting).use pubsselect title , (select pub_name from publishers where pub_id = titles.pub_id) as pub_namefrom titlesorder by pub_name |
 |
|
|
|
|
|