Multiselect

2002-12-05 Thread Daya Krishan Dubey
Hi,

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

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

Thanks in advance
DK Dubey






-
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




re: Multiselect

2002-12-05 Thread Victoria Reznichenko
Daya,
Thursday, December 05, 2002, 4:14:02 PM, you wrote:

DKD can anybody tell me how can i select,update, delete the records from two
DKD table having same structure in the mysql.

DKD For ex

DKD MainTable
DKD ---
DKD   id(int)|val (varchar)
DKD ---
DKD 1   a
DKD 2   b
DKD 3   c
DKD ---

DKD Duplicate Table
DKD ---
DKD  id (int) | val (varchar)
DKD ---
DKD 1   d
DKD 5   e
DKD 6   f
DKD ---

DKD I want result for id 1 like this

DKD ---
DKD  id (int) | val (varchar)
DKD ---
DKD 1   a
DKD 1   d
DKD ---

Since v4.0 you can easy do it using UNION:
  http://www.mysql.com/doc/en/UNION.html

In 3.23. you can do it using TEMPORARY tables.



-- 
For technical support contracts, goto https://order.mysql.com/?ref=ensita
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___ ___   __
  /  |/  /_ __/ __/ __ \/ /Victoria Reznichenko
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
   ___/   www.mysql.com





-
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




Re: Multiselect

2002-12-05 Thread Roger Baklund
* 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