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 |
|
Mondeo
Constraint Violating Yak Guru
287 Posts |
Posted - 2008-01-25 : 06:33:02
|
| Hi,I've got 3 queries which all return a single value. I'm trying to join these 3 values to return just 1. I've tried thisSELECT * FROM ((SELECT TOP 1 [text] from tblRandomText WHERE section = 1 ORDER BY NEWID()) &(SELECT TOP 1 [text] from tblRandomText WHERE section = 2 ORDER BY NEWID()) &(SELECT TOP 1 [text] from tblRandomText WHERE section = 3 ORDER BY NEWID()) &)But it doesn't work.Is there any way to do this?Thanks |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2008-01-25 : 07:58:16
|
| SELECT (SELECT TOP 1 [text] from tblRandomText WHERE section = 1 ORDER BY NEWID()) +(SELECT TOP 1 [text] from tblRandomText WHERE section = 2 ORDER BY NEWID()) +(SELECT TOP 1 [text] from tblRandomText WHERE section = 3 ORDER BY NEWID()) _______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenpSSMS Add-in that does a few things: www.ssmstoolspack.com <- new version out |
 |
|
|
|
|
|