| Author |
Topic |
|
stineco
Starting Member
6 Posts |
Posted - 2005-08-22 : 05:01:36
|
| i need a script that: select all records from a room, if the records in that room have a recordcount less then 100 records continue with next room until we have 100 records, the next time i run this script, i must give me other rooms (random) |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-22 : 05:06:34
|
| Is this?Select top 100 rooms from room order by newid()Otherwise post some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
 |
|
|
stineco
Starting Member
6 Posts |
Posted - 2005-08-22 : 05:13:25
|
| the table is eq (equipement)not rooms |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-22 : 05:17:44
|
| Replace rooms by eqSelect top 100 rooms from eq order by newid()If you dont get your desired output, post some sample data and the result you wantMadhivananFailing to plan is Planning to fail |
 |
|
|
stineco
Starting Member
6 Posts |
Posted - 2005-08-22 : 05:32:14
|
| When i use this it doesn't give me the ALL the records of that room records i just want to select all records of a room, (room 00.01) When the records are less then 100 go to (room 00.02),(room 00.03) until we reach 100 recordsresult i wantid 01room 00.01id 02room 00.01id 03room 00.01id 04room 00.01id 05room 00.01id 06room 00.01id 07room 00.01id 08room 00.01id 09room 00.02id 10room 00.02id 11room 00.02id 12room 00.02id 13room 00.04id 14room 00.04id 15room 00.04id 16room 00.04go until we reach 100 records |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-22 : 05:37:03
|
| Select top 100 rooms from eq where rooms >='00.01' order by roomsMadhivananFailing to plan is Planning to fail |
 |
|
|
stineco
Starting Member
6 Posts |
Posted - 2005-08-22 : 05:46:34
|
| this works, but the next time i run the script it must give me other rooms |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-08-22 : 05:56:25
|
| Try thisSelect * from (Select top 100 rooms from eqwhere rooms >='00.01'order by newid()) T order by roomsMadhivananFailing to plan is Planning to fail |
 |
|
|
stineco
Starting Member
6 Posts |
Posted - 2005-08-22 : 07:31:19
|
| i tried thisSelect rm_id,omschrijving from (Select top 100 * from eqwhere bl_id='004' and fl_id in ('02','04') and rm_id >='00.01'order by newid()) T order by rm_idwhen i run the script the second time he dont get all the records of a room |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
|