----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, July 21, 2001 12:33 PM
Subject: Mysql syntax

> If I wanted to asssign John Doe to system1, how would I write the
statement in sql to pull the sysid from the > system table via the sysname,
and then to update the user table with the sysid and John Doe?

INSERT INTO users (sysid, username)
SELECT sysid, 'John Doe'
FROM system
WHERE sysname = 'system1';

You might want to add a primary key to the users table (will come in handy
when you start querying this table), and an index to system.sysname.


--
Allen Grace

Dark Blue Sea Pty Ltd
ph +61 7 3007 0000
fax +61 7 3007 0001

***The opinions expressed in this email are my own and are not
representative of DBS Pty Ltd.***


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to