* Daya Krishan Dubey
> can anybody tell me how can i select,update, delete the records from two
> table having same structure in the mysql.

"select", "update" and "delete" are three different operations. From your
example data, it looks like you want to do "select".

> For ex
>
> MainTable
> -------------------
>   id(int)|      val (varchar)
> -------------------
>       1               a
>       2               b
>       3               c
> -------------------
>
> Duplicate Table
> -------------------
>  id (int) |   val (varchar)
> -------------------
>       1       d
>       5       e
>       6       f
> -------------------
>
> I want result for id 1 like this
>
> -------------------
>  id (int) |   val (varchar)
> -------------------
>       1       a
>       1       d
> -------------------

If you use mysql 4.0.x, you can try UNION:

<URL: http://www.mysql.com/doc/en/UNION.html >

If you use mysql 3.23.x, you can use a temporary table:

CREATE TEMPORARY TABLE tmp1
  SELECT * FROM MainTable
  WHERE id = 1;
INSERT INTO tmp1
  SELECT * FROM DuplicateTable
  WHERE id = 1;
SELECT * FROM tmp1;

--
Roger


---------------------------------------------------------------------
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