| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |
|

01-07-10, 11:42
|
|
Registered User
|
|
Join Date: Nov 2008
Posts: 115
|
|
|
ID update with various tables in a database
|
|
Hello,
I am using login table and user table. When i add some datas in login table, that corresponding ID(Autonumber field) from login table must be updated with user table.
How to perform this? This must handles for very large number of users.
Thankyou.
|
|

01-07-10, 12:04
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
|
|
use the LAST_INSERT_ID function
it is explained quite adequately in da manual
you do have a mysql reference manual, yes?
|
|

01-08-10, 09:37
|
|
Registered User
|
|
Join Date: Nov 2008
Posts: 115
|
|
|
|
No i am not having. Where i need to get it?
|
|

01-08-10, 10:31
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
|
|
Quote:
Originally Posted by bharanidharanit
No i am not having. Where i need to get it?
|
MySQL :: MySQL Documentation
available in several languages
|
|

01-09-10, 18:09
|
|
Registered User
|
|
Join Date: Nov 2008
Posts: 115
|
|
Hi, How about creating triggers in my case. Is that good?
|
|

01-09-10, 18:15
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
|
|
Quote:
Originally Posted by bharanidharanit
Is that good?
|
depends on what you're trying to accomplish
|
|

01-09-10, 18:54
|
|
Registered User
|
|
Join Date: Nov 2008
Posts: 115
|
|
Quote:
Originally Posted by r937
depends on what you're trying to accomplish
|
Again in a social networking website, they have profile pages, scrapbook, friendlist, photos etc. This must be different among every users. They must have different tables. How are they linking every tables? If mostly by id, how to link every tables, after a user registration?
|
|

01-09-10, 19:14
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
|
|
|
|

01-10-10, 08:46
|
|
Registered User
|
|
Join Date: Nov 2008
Posts: 115
|
|
Hey thankyou, that really helps me...
|
|

01-11-10, 08:26
|
|
Registered User
|
|
Join Date: Nov 2008
Posts: 115
|
|
Hi,
i am having tbl_users and tbl_profile tables. After a new record created in tbl_users, i want to get tbl_users.id and insert that id in a profile table. I used this coding, but i know how to retrieve id from tbl_users to a tbl_profile table?
Here's my coding,
Code:
use db_snw;
create trigger update_id
after update on tbl_users
for each row begin
end
|
|

01-11-10, 09:21
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
|
|
Quote:
Originally Posted by bharanidharanit
Hi i want to get tbl_users.id
|
please see post #2 in this thread
|
|

01-11-10, 10:49
|
|
Registered User
|
|
Join Date: Nov 2008
Posts: 115
|
|
I referred that, but that one is little complex for me
|
|

01-11-10, 10:52
|
|
SQL Consultant
|
|
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,525
|
|
Quote:
Originally Posted by bharanidharanit
I referred that, but that one is little complex for me
|
LAST_INSERT_ID is "too complex" for you? and yet you're trying to write a trigger?
something about this doesn't smell right....
|
|

01-11-10, 10:57
|
|
Registered User
|
|
Join Date: Nov 2008
Posts: 115
|
|
I dint mentioned about LAST_INSERT_ID, but about da manual!!!
|
|

01-11-10, 11:08
|
|
Registered User
|
|
Join Date: Nov 2008
Posts: 115
|
|
Hello,
Do you mean this? This is returning all the values from the insert table.
Code:
select * from tbl_users where id=last_insert_id(id);
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|