Garayed.com  

Go Back   Garayed.com > mySQL
FAQ Members List Calendar Search Today's Posts Mark Forums Read


Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-24-2006, 02:46 PM
Josselin
 
Posts: n/a
Default insert count (many) into column (of one)..

I have one-to-many relationship Manager ->> Employee , tables are
already created (40'000 items)

Manager Employee
id id
data11 data21
data12 data22
... ..
manager_id

as I need to keep the count of the number of managed employeed in the
Manager Table
I created a new column in the Manager table

Manager
id
data11
data12
...
employees_count

and I would like to update directly the table Manager from the terminal
(using mysql),
I know how to modiffy one record, but I don't know how to do that for
all managers ...
how should I proceed..

thanks

joss

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 11-24-2006, 03:43 PM
strawberry
 
Posts: n/a
Default Re: insert count (many) into column (of one)..


Josselin wrote:

> I have one-to-many relationship Manager ->> Employee , tables are
> already created (40'000 items)
>
> Manager Employee
> id id
> data11 data21
> data12 data22
> .. ..
> manager_id
>
> as I need to keep the count of the number of managed employeed in the
> Manager Table
> I created a new column in the Manager table
>
> Manager
> id
> data11
> data12
> ..
> employees_count
>
> and I would like to update directly the table Manager from the terminal
> (using mysql),
> I know how to modiffy one record, but I don't know how to do that for
> all managers ...
> how should I proceed..
>
> thanks
>
> joss


Don't.

Don't duplicate info in the database that can be calculated from other
info in the database.
Just recalculate as when required.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:19 AM.




LinkBacks Enabled by vBSEO 3.0.0 © 2007, Crawlability, Inc.