|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Generate data entry and reporting .NET Web apps in minutes, straight from your database. Read our FREE whitepaper “Build Web 2.0 Applications Without Hand-Coding” Download now! |
|
#1
|
|||
|
|||
|
Calling all tsql Gurus
Hi all I have a guestion that is making my brain hurt.
I have a table with a list of names and an ID that identifies them with a group. It looks like NAME GroupID A.Smith 1 B.Smith 1 C.Smith 1 D.Smith 1 E.Smith 1 F.Smith 1 G.Smith 1 H.Smith 1 I.Smith 1 J.Smith 1 I need to update the table using a stored procedure. I need to take 58% of the records and change their GroupID = 2 and take 42% of the records and change their GroupID to 3. I am totally stumped and was wondering if any one has any Ideas or if this is even possible? |
|
#2
|
|||
|
|||
|
You will have to round your round your percentage based on your data population. You will first need to calculate the total number of records then you can use top [n], where n is the calculated number.
__________________
El éxito consiste en una serie de pequeñas victorias día a día MySQL, MS SQL, MS ACCESS, Oracle Database Manager - http://victorpendleton.net/products/psdviewer.html |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Calling all tsql Gurus |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|