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 |
|
Aequitas
Starting Member
8 Posts |
Posted - 2008-08-29 : 13:37:51
|
| Hi Experts,I have a database that has a document table, wherein a field indicates whether that document is "Responsive" or "Non-repsonsive."Is there a way to build a query that will return all of the Responsive documents and only a sample 10% of the Non-responsive documents?Thanks |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-29 : 13:43:06
|
| [code]SELECT * FROM YourTable WHERE documenttype='Responsive'UNION ALLSELECT * FROM(SELECT TOP 10 PERCENT * FROm YourTable where documenttype='Non-Responsive')t[/code] |
 |
|
|
Aequitas
Starting Member
8 Posts |
Posted - 2008-08-29 : 13:53:42
|
| Thanks! I'll try that now. |
 |
|
|
Aequitas
Starting Member
8 Posts |
Posted - 2008-08-29 : 17:54:13
|
| I had to tweak it a bit, but it worked. Thank you for reminding me about UNION ALL. Appreciate all the help! |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-30 : 02:03:38
|
quote: Originally posted by Aequitas I had to tweak it a bit, but it worked. Thank you for reminding me about UNION ALL. Appreciate all the help!
you're welcome |
 |
|
|
|
|
|