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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 select records

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2005-08-16 : 08:03:38
Stijn writes "Hello,

I have SQL 7 with WINDOWS 2000 SERVER

My problem is that i am looking for a script

my db is for equipement inventory

how can i select all the records from a room,
if this room (room1)has less of 100 records he needs te go to the follow room(room2), en the next room until he's got 100 records,

sorry for my english"

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2005-08-16 : 08:06:42
Is this?

Select top 100 room from yourtable

Otherwise refer this and post accordingly
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

raclede
Posting Yak Master

180 Posts

Posted - 2005-08-17 : 01:27:18
SET ROWCOUNT 100
SELECT * FROM YourTable WHERE Room='Room1' UNION
SELECT * FROM YourTable WHERE Room='Room2' UNION
SELECT * FROM YourTable WHERE Room='Room3' UNION
SELECT * FROM YourTable WHERE Room='Room4'
Go to Top of Page
   

- Advertisement -