SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to make correction

    Hi folks,

    I ran following commands
    mysql> USE AAADatabase

    mysql> INSERT INTO domains VALUES ('www.aab.org','/var/www/www.aaa.net/web/');

    It should be;
    Code:
    INSERT INTO domains VALUES ('www.aaa.net','/var/www/www.aaa.net/web/');
    Please advise how to correct it? TIA

    B.R.
    satimis

  2. #2
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,214
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Code:
    UPDATE domains
       SET the_unknown_column = 'www.aaa.net'
     WHERE the_unknown_column = 'www.aab.org'
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  3. #3
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by r937 View Post
    Code:
    UPDATE domains
       SET the_unknown_column = 'www.aaa.net'
     WHERE the_unknown_column = 'www.aab.org'
    Hi,

    Thanks for your advice.

    Hi,

    Thanks for your advice and link.

    mysql> UPDATE domains
    -> SET the_unknown_column = 'www.aaa.net'
    -> WHERE the_unknown_column = 'www.aab.org';
    ERROR 1054 (42S22): Unknown column 'the_unknown_column' in 'where clause'

    There is an error

    B.R.
    satimis

  4. #4
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,214
    Mentioned
    58 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by satimis View Post
    There is an error
    you bet!!!

    did you tell us the column names in your domains table?

    no!

    so i guessed

    apparently i guessed wrong, eh

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  5. #5
    SitePoint Member
    Join Date
    Nov 2006
    Posts
    24
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi folks,


    Sorry I haven't run mysql sometimes. It took me a while to figure out the command syntax from my recollection.

    Mysql version
    5.1.49-1ubuntu8.1


    $ mysql -u root -p

    mysql> SHOW databases;
    Code:
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | lighttpd           |
    | mysql              |
    +--------------------+
    3 rows in set (0.00 sec)
    mysql> USE lighttpd;

    mysql> SHOW tables;
    Code:
    +--------------------+
    | Tables_in_lighttpd |
    +--------------------+
    | domains            |
    +--------------------+
    1 row in set (0.00 sec)
    mysql> SHOW COLUMNS FROM domains;
    Code:
    +---------+--------------+------+-----+---------+-------+
    | Field   | Type         | Null | Key | Default | Extra |
    +---------+--------------+------+-----+---------+-------+
    | domain  | varchar(64)  | NO   | PRI | NULL    |       |
    | docroot | varchar(128) | NO   |     | NULL    |       |
    +---------+--------------+------+-----+---------+-------+
    2 rows in set (0.00 sec)
    mysql> UPDATE domains
    Code:
        -> SET domain = 'www.aaa.net'
        -> WHERE domain = 'www.aab.org';
    Query OK, 1 row affected (0.00 sec)
    Rows matched: 1  Changed: 1  Warnings: 0
    Thanks


    satimis


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •