473,569 Members | 2,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CREATE TABLE SELECT, ON DUPLICATE KEY UPDATE, and UNION

[SQL]
CREATE TABLE /*! IF NOT EXISTS */ blah
SELECT * FROM blah1 ON DUPLICATE KEY UPDATE unique_key=uniq ue_key
UNION
SELECT * FROM blah2 ON DUPLICATE KEY UPDATE unique_key=uniq ue_key
TYPE=MyISAM
[/SQL]

This transaction produces a syntax error
Syntax error near "ON DUPLICATE KEY UPDATE unique_'"
My task is to conjoin 2 tables together into one table with unique rows
from 2 tables with "duplicates " (rows that have identical values in
"unique_key " that should not be the case).

Env: MySQL 4.1, MySQL 5.0

Thanx
Phil

Nov 23 '05 #1
0 1913

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

Similar topics

2
23686
by: ajay | last post by:
How to write a single update sql statement to update different set of attributes of a table. In other words what will be the value of indicator variables to ignore updates of some attributes in a update statement. e.g. EXEC SQL UPDATE vA:iA vB:iB vC:iC in TABLE 1 where vD = ...
1
3417
by: Stephen Patten | last post by:
Hi All, While in the process of building my table (40 or so Insert statments) can I then query ("select * from @Table_variable") and use the results up to theat point for another insert into @Table_varible? If you look for stepID -15 I have commented that section out due to it not retuning the correct values. Thank you in advance
3
8921
by: manning_news | last post by:
Is there an way to create a table of months using SQL functions? If "July" is entered for the beginning month, and "December" is entered for the ending month, then I'd like to create a table with 6 rows, one for July, August,....December. Thanks.
2
4236
by: Laertes | last post by:
Hi, I would like to create a table that will allow only two records per date entered. So you should be able to input as many dates as you like, but you can have each date only twice! It's a database for patients receiving a specific treatment (We cannot have more than 2 patients/day). I want this restriction so as to ensure we don't...
16
4163
by: tyrfboard | last post by:
I've been searching for awhile now on how to remove duplicates from a table within an Access db and have found plenty of articles on finding or deleting duplicates. All I want to do is remove them from within an SQL query - leaving one of the records behind of course. I have a mailing list comprised of a union query that gets records from...
3
2164
by: AK | last post by:
Hi Our product uses MS-SQL Server 2000. One of our customer has 10 installations with each installation stroring data in its own database. Now the customer wants to consolidate these databases into one and we already have plan for that by consolidating one DB at a time. But first they want to find how many unique or duplicate entries they...
16
4866
by: UDBDBA | last post by:
Hi All: I need some clarification on a MERGE statement. The database is on V8 FP12 (AIX) 64bit. The source table is tableA. The target is a View "FACT" with UNION ALL because of the 512 Gig restriction. Will a MERGE into this view "FACT" from tableA work?
1
2255
by: PerumalSamy | last post by:
Hi I am having table with more 13 lakhs records. I am having duplicate records in it. i need to remove that. I wrote the following query SELECT *
6
4305
by: Alvin SIU | last post by:
Hi all, I have a table in Db2 v8 like this: Team Name Role ------ -------- --------------------- A Superman Leader A Batman Member A WonderWoman Member B Alvin Leader
0
7618
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7926
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7982
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6286
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5222
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3656
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3644
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1226
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
944
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.