Re: Fwd: Need help on Multi-table update queries

Re: Fwd: Need help on Multi-table update queries

am 31.07.2002 20:02:51 von Sinisa Milivojevic

Victoria Reznichenko writes:
> Hi!
> This error occurs when update several columns and use LEFT JOIN clause
> (I didn't test it with other JOIN's).
>
>
> This is a forwarded message
> From: deep kapasi
> To:
> Date: Monday, July 29, 2002, 7:28:57 AM
> Subject: Need help on Multi-table update queries


Hi!

This is not a bug.

For the moment multi-table updates don't support JOIN syntax.

You can only specify connection between tables in the WHERE clause.

--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ 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 bugs-thread12263@lists.mysql.com
To unsubscribe, e-mail

Re: Fwd: Need help on Multi-table update queries

am 01.08.2002 08:06:03 von deep kapasi

Hi,

Thx for replying

I am little bit confused after your reply, u wrote
> For the moment multi-table updates don't support
> JOIN syntax.
If I am now wrong, you mean to say that right now
MySQL doesn't support JOIN syntax AT ALL. Right?

Well let me clarify again I am using MySQL 4.0.2, and
JOIN syntax is working properly on some queries

Run the below script it will create a 2 Innodb tables
and insert some record in it and then it will run
Update query with JOIN syntax

CREATE TABLE `parent` (
`id` int(11) NOT NULL auto_increment,
`tst` text,
`tst1` text,
PRIMARY KEY (`id`)
) TYPE=InnoDB;

CREATE TABLE `child` (
`ID` int(11) NOT NULL auto_increment,
`ParId` int(11) default NULL,
`tst` text,
`tst1` text,
PRIMARY KEY (`ID`),
KEY `IX_ParId_Child` (`ParId`),
FOREIGN KEY (`ParId`) REFERENCES `test.parent`
(`id`)
) TYPE=InnoDB;

INSERT INTO Parent(TST,TST1)
VALUES("MySQL","MySQL
AB"),("MSSQL","Microsoft"),("ORACLE","ORACLE");

INSERT INTO Child(ParId,TST)
VALUES(1,"MySQL AB"),(2,"Microsoft"),(3,"ORACLE");

Now run below UPDATE query -
UPDATE Child
LEFT JOIN Parent ON Parent.Id = Child.ParId
SET Child.tst = Parent.tst;

Above UPDATE statement with JOIN syntax will run
smoothly as it updates only one column

Now run below UPDATE query, it tries to update 2
columns -
UPDATE Child
LEFT JOIN Parent ON Parent.Id = Child.ParId
SET Child.tst = Parent.tst,
Child.tst1 = Parent.tst1 ;

It will give ERROR 1105: Unknow Error

So I think its an BUG.

Well I may have misunderstood or missed something so I
may be wrong.


-----
Regards,



--- Sinisa Milivojevic wrote:
> Victoria Reznichenko writes:
> > Hi!
> > This error occurs when update several columns and
> use LEFT JOIN clause
> > (I didn't test it with other JOIN's).
> >
> >
> > This is a forwarded message
> > From: deep kapasi
> > To:
> > Date: Monday, July 29, 2002, 7:28:57 AM
> > Subject: Need help on Multi-table update queries
>
>
> Hi!
>
> This is not a bug.
>
> For the moment multi-table updates don't support
> JOIN syntax.
>
> You can only specify connection between tables in
> the WHERE clause.
>
> --
> Regards,
> __ ___ ___ ____ __
> / |/ /_ __/ __/ __ \/ / Mr. Sinisa
> Milivojevic
> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime
> Developer
> /_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
> <___/ www.mysql.com
>


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.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 bugs-thread12264@lists.mysql.com
To unsubscribe, e-mail

Re: Fwd: Need help on Multi-table update queries

am 01.08.2002 16:00:05 von Sinisa Milivojevic

deep kapasi writes:
> Hi,
>
> Thx for replying
>
> I am little bit confused after your reply, u wrote
> > For the moment multi-table updates don't support
> > JOIN syntax.
> If I am now wrong, you mean to say that right now
> MySQL doesn't support JOIN syntax AT ALL. Right?
>
>
>
> -----
> Regards,
>
>

NO.

I wrote : "For the moment multi-table updates don't support JOIN
....".

Where did you read the rest ??

MySQL does not support JOIN syntax in multi-table updates. It supports
JOIN syntax in SELECT's and multi-table deletes.

--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ 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 bugs-thread12267@lists.mysql.com
To unsubscribe, e-mail

Re: Fwd: Need help on Multi-table update queries

am 02.08.2002 09:00:49 von deep kapasi

--- Sinisa Milivojevic wrote:
> deep kapasi writes:
> > Hi,
> >
> > Thx for replying
> >
> > I am little bit confused after your reply, u wrote
> > > For the moment multi-table updates don't support
> > > JOIN syntax.
> > If I am now wrong, you mean to say that right now
> > MySQL doesn't support JOIN syntax AT ALL. Right?
> >
> >
> >
> > -----
> > Regards,
> >
> >
>
> NO.
>
> I wrote : "For the moment multi-table updates don't
> support JOIN
> ...".
>
> Where did you read the rest ??
>
> MySQL does not support JOIN syntax in multi-table
> updates. It supports
> JOIN syntax in SELECT's and multi-table deletes.
>
> --
> Regards,

Sorry, i think u misunderstood me.
I wrote that sentence incorrectly, infact i should
write -
If I am now wrong, you mean to say that right now
MySQL doesn't support JOIN syntax in UPDATE statement
AT ALL. Right?


Back to the promblem, as you wrote in your previous
mail
> You can only specify connection between tables in
> the WHERE clause.
so i tried following UPDATE query
UPDATE Child, Parent
SET Child.tst = Parent.tst,
Child.tst1 = Parent.tst1
WHERE Parent.Id = Child.ParId;

It too gives Error 1105: Unknown Error

Is above UPDATE query correct?


-----
Regards

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.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 bugs-thread12271@lists.mysql.com
To unsubscribe, e-mail

Re: Fwd: Need help on Multi-table update queries

am 02.08.2002 14:37:00 von Sinisa Milivojevic

deep kapasi writes:
>
> Sorry, i think u misunderstood me.
> I wrote that sentence incorrectly, infact i should
> write -
> If I am now wrong, you mean to say that right now
> MySQL doesn't support JOIN syntax in UPDATE statement
> AT ALL. Right?
>
>

Right !

> Back to the promblem, as you wrote in your previous
> mail
> > You can only specify connection between tables in
> > the WHERE clause.
> so i tried following UPDATE query
> UPDATE Child, Parent
> SET Child.tst = Parent.tst,
> Child.tst1 = Parent.tst1
> WHERE Parent.Id = Child.ParId;
>
> It too gives Error 1105: Unknown Error
>
> Is above UPDATE query correct?
>
>
> -----
> Regards

I will check the above !!

It should work ...


--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ 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 bugs-thread12272@lists.mysql.com
To unsubscribe, e-mail

Re: Fwd: Need help on Multi-table update queries

am 03.08.2002 15:43:40 von Sinisa Milivojevic

deep kapasi writes:
> --- Sinisa Milivojevic wrote:
> so i tried following UPDATE query
> UPDATE Child, Parent
> SET Child.tst = Parent.tst,
> Child.tst1 = Parent.tst1
> WHERE Parent.Id = Child.ParId;
>
> It too gives Error 1105: Unknown Error
>
> Is above UPDATE query correct?
>
>
> -----
> Regards
>

Hi!

I just tested above and it worked like a charm with 4.0.2.

Can you provide me with a full test case ????????

--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ 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 bugs-thread12276@lists.mysql.com
To unsubscribe, e-mail

Re: Fwd: Need help on Multi-table update queries

am 05.08.2002 10:15:11 von deep kapasi

Hi,

I am using MySQL 4.0.2 on
Microsoft Windows 2000
5.00.2195
Service Pack 2

Please copy the following script to a new file and
save it (say UpdateQuery.sql)
------------------------------------------------

CREATE TABLE IF NOT EXISTS `parent` (
`id` int(11) NOT NULL auto_increment,
`tst` text,
`tst1` text,
PRIMARY KEY (`id`)
) TYPE=InnoDB;

CREATE TABLE IF NOT EXISTS `child` (
`ID` int(11) NOT NULL auto_increment,
`ParId` int(11) default NULL,
`tst` text,
`tst1` text,
PRIMARY KEY (`ID`),
KEY `IX_ParId_Child` (`ParId`),
FOREIGN KEY (`ParId`) REFERENCES `test.parent`
(`id`)
) TYPE=InnoDB;

INSERT INTO Parent(tst,tst1)
VALUES("MySQL","MySQL AB"), ("MSSQL","Microsoft"),
("ORACLE","ORACLE");

INSERT INTO CHILD(ParId)
VALUES(1), (2), (3);

UPDATE Child, Parent
SET Child.tst = Parent.tst,
Child.tst1 = Parent.tst1
WHERE Child.ParId = Parent.Id;
---------------------------------------------------

Now run the UpdateQuery.sql from command line, Script
creates a 2 InnoDB tables Parent & Child in given
database then inserts a records in it, after insertion
it tries to UPDATE the child table with the
corresponding value of parent record.

Here is the output when I run the script
C:\>mysql test < UpdateQuery.sql
ERROR 1105 at line 24: Unknown error

Following is the output of SHOW VARIABLES command
-----------------------------------------------------
Variable_name Value
back_log 50
basedir C:\\mysql\\
bdb_cache_size 8388600
bdb_log_buffer_size 32768
bdb_home C:\\mysql\\data\\
bdb_max_lock 10000
bdb_logdir
bdb_shared_data OFF
bdb_tmpdir C:\\WINNT\\TEMP\\
bdb_version Sleepycat Software: Berkeley DB 3.2.9a:
(July 5, 2002)
binlog_cache_size 32768
character_set latin1
character_sets latin1 big5 czech euc_kr gb2312 gbk
latin1_de sjis tis620 ujis dec8 dos german1 hp8
koi8_ru latin2 swe7 usa7 cp1251 danish hebrew win1251
estonia hungarian koi8_ukr win1251ukr greek win1250
croat cp1257 latin5
concurrent_insert OFF
connect_timeout 5
datadir C:\\mysql\\data\\
delay_key_write OFF
delayed_insert_limit 100
delayed_insert_timeout 300
delayed_queue_size 1000
flush OFF
flush_time 1800
ft_min_word_len 4
ft_max_word_len 254
ft_max_word_len_for_sort 20
ft_boolean_syntax + -><()~*:""&|
have_bdb YES
have_innodb YES
have_isam YES
have_raid NO
have_symlink YES
have_openssl NO
have_query_cache YES
init_file
innodb_additional_mem_pool_size 2097152
innodb_buffer_pool_size 16777216
innodb_data_file_path
ibdata1:58M;ibdata2:100M:autoextend
innodb_data_home_dir c:\\mysql\\InnoDB\\ibdata
innodb_file_io_threads 9
innodb_force_recovery 0
innodb_thread_concurrency 8
innodb_flush_log_at_trx_commit ON
innodb_fast_shutdown ON
innodb_flush_method
innodb_lock_wait_timeout 50
innodb_log_arch_dir c:\\mysql\\InnoDB\\iblogs
innodb_log_archive OFF
innodb_log_buffer_size 12582912
innodb_log_file_size 10485760
innodb_log_files_in_group 2
innodb_log_group_home_dir c:\\mysql\\InnoDB\\iblogs
innodb_mirrored_log_groups 1
interactive_timeout 28800
join_buffer_size 131072
key_buffer_size 12288
language C:\\mysql\\share\\english\\
large_files_support ON
log OFF
log_update OFF
log_bin OFF
log_slave_updates OFF
log_slow_queries OFF
long_query_time 10
low_priority_updates OFF
lower_case_table_names 1
max_allowed_packet 16776192
max_binlog_cache_size 4294967295
max_binlog_size 1073741824
max_connections 100
max_connect_errors 10
max_delayed_threads 20
max_heap_table_size 16777216
max_join_size 4294967295
max_sort_length 1024
max_user_connections 0
max_tmp_tables 32
max_write_lock_count 4294967295
myisam_bulk_insert_tree_size 8388608
myisam_max_extra_sort_file_size 256
myisam_max_sort_file_size 2047
myisam_recover_options OFF
myisam_sort_buffer_size 8388608
named_pipe OFF
net_buffer_length 1024
net_read_timeout 30
net_retry_count 10
net_write_timeout 60
open_files_limit 0
pid_file C:\\mysql\\data\\w2ks.pid
port 3306
protocol_version 10
record_buffer 131072
record_rnd_buffer 131072
rpl_recovery_rank 0
query_buffer_size 0
query_cache_limit 1048576
query_cache_size 0
query_cache_startup_type 1
safe_show_database OFF
server_id 1
slave_net_timeout 3600
skip_locking ON
skip_networking OFF
skip_show_database OFF
slow_launch_time 2
socket MySQL
sort_buffer 65528
sql_mode 0
table_cache 4
table_type MYISAM
thread_cache_size 0
thread_stack 65536
transaction_isolation READ-COMMITTED
timezone India Standard Time
tmp_table_size 33554432
tmpdir C:\\WINNT\\TEMP\\
version 4.0.2-alpha-max-nt
wait_timeout 28800
----------------------------------------------------


Pls let me know if u want any more info.

-----
Regards



--- Sinisa Milivojevic wrote:
> deep kapasi writes:
> > --- Sinisa Milivojevic wrote:
> > so i tried following UPDATE query
> > UPDATE Child, Parent
> > SET Child.tst = Parent.tst,
> > Child.tst1 = Parent.tst1
> > WHERE Parent.Id = Child.ParId;
> >
> > It too gives Error 1105: Unknown Error
> >
> > Is above UPDATE query correct?
> >
> >
> > -----
> > Regards
> >
>
> Hi!
>
> I just tested above and it worked like a charm with
> 4.0.2.
>
> Can you provide me with a full test case ????????
>
> --
> Regards,
> __ ___ ___ ____ __
> / |/ /_ __/ __/ __ \/ / Mr. Sinisa
> Milivojevic
> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime
> Developer
> /_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
> <___/ www.mysql.com
>


__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.com

__________________________________________________
Do You Yahoo!?
Yahoo! Health - Feel better, live better
http://health.yahoo.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 bugs-thread12280@lists.mysql.com
To unsubscribe, e-mail

Re: Fwd: Need help on Multi-table update queries

am 06.08.2002 22:20:28 von Sinisa Milivojevic

deep kapasi writes:
>
> Sorry, i think u misunderstood me.
> I wrote that sentence incorrectly, infact i should
> write -
> If I am now wrong, you mean to say that right now
> MySQL doesn't support JOIN syntax in UPDATE statement
> AT ALL. Right?
>
>
> Back to the promblem, as you wrote in your previous
> mail
> > You can only specify connection between tables in
> > the WHERE clause.
> so i tried following UPDATE query
> UPDATE Child, Parent
> SET Child.tst = Parent.tst,
> Child.tst1 = Parent.tst1
> WHERE Parent.Id = Child.ParId;
>
> It too gives Error 1105: Unknown Error
>
> Is above UPDATE query correct?
>
>
> -----
> Regards

No, that was a bug that I have fixed today.

--
Regards,
__ ___ ___ ____ __
/ |/ /_ __/ __/ __ \/ / Mr. Sinisa Milivojevic
/ /|_/ / // /\ \/ /_/ / /__ MySQL AB, Fulltime Developer
/_/ /_/\_, /___/\___\_\___/ Larnaca, Cyprus
<___/ 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 bugs-thread12313@lists.mysql.com
To unsubscribe, e-mail