473,505 Members | 16,544 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

arcane MySQL db query...

In my continuing attempt to make a user module for my CMS work, I keep
running into errors with the folowing query, which makes no sense to me
at all:

INSERT IGNORE INTO mos_comprofiler(id,user_id) SELECT id,id FROM mos_users";

where mos_comprofiler is a new parallel User DB and mos_users is the
original database of users. This first query is supposed to work when
there is a id column in mos_users. However, my mos_users table has a
user_id column insted.

So I then altered the above to read:
INSERT IGNORE INTO mos_comprofiler(id,user_id) SELECT id,user_id FROM
mos_users";

so that it would parse the user-id column instead of id - but it didn't
work.

I then ran the following query:
INSERT IGNORE INTO mos_comprofiler(id,user_id) SELECT id,user_id FROM
test_users";

where test_users is a standard table of users with the normal id field.
The query fails and phpmyadmin says: #1054 - Unknown column 'user_id' in
'field list'.

To my eyes, the query doesn't seem to make sense -- or the syntax being
used is arcane, I'm not sure which. Any ideas how I can make this query
work for a mos_users table that has the field user_id insted of id?

August
Aug 3 '05 #1
2 1513
August wrote:
INSERT IGNORE INTO mos_comprofiler(id,user_id) SELECT id,id FROM
mos_users";
Any ideas how I can make this query
work for a mos_users table that has the field user_id insted of id?


Does this work:

INSERT IGNORE INTO mos_comprofiler(id,user_id) SELECT user_id,user_id
FROM "mos_users";

Regards,
Bill K.
Aug 4 '05 #2
Bill Karwin wrote:
August wrote:
INSERT IGNORE INTO mos_comprofiler(id,user_id) SELECT id,id FROM
mos_users";
Any ideas how I can make this query work for a mos_users table that
has the field user_id insted of id?

Does this work:

INSERT IGNORE INTO mos_comprofiler(id,user_id) SELECT user_id,user_id
FROM "mos_users";

Regards,
Bill K.

Bill,
Thanks for that - it worked great. I anticipated and error 1054 -
duplicate field, but got no such error. Thanks again!

August
Aug 5 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3510
by: Lenz Grimmer | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, MySQL 4.0.14, a new version of the popular Open Source/Free Software Database, has been released. It is now available in source and binary...
0
3925
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
1
3002
by: Saqib Ali | last post by:
I have created 2 tables in my MySQL database. A_TAB and B_TAB. They have auto-incrementing integer primary keys respectively named A_ID & B_ID. When I created B_TAB, I declared a field named A_ID...
1
3358
by: jlee | last post by:
I'm pretty much a newbie on mysql, and I need some help. I am running mysql Ver 12.22 Distrib 4.0.24, for portbld-freebsd5.4 (i386) on a server hosting an active website. The site's developer...
1
2817
by: Good Man | last post by:
Hi there I've noticed some very weird things happening with my current MySQL setup on my XP Laptop, a development machine. For a while, I have been trying to get the MySQL cache to work....
3
6072
by: Juan Antonio Villa | last post by:
Hello, I'm having a problem replicating a simple database using the binary log replication, here is the problem: When the master sends an update to the slave, an example update reads as follows:...
1
15369
by: Ike | last post by:
Recently, I began using a different MySQL verver (i.e. different machine as well as different version#, going from 4.12a to 4.1.9 max). The following query used to work: select firstname,...
3
8466
by: Me Alone | last post by:
Hello: I am trying to edit some C code I found in "The definitive guide to using, programming, and administering MySQL" by Paul DuBois. This C client program connects and then segfaults when...
221
366971
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application...
0
7218
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7103
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7307
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
5035
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4701
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3188
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1532
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
755
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
409
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.