Altough this is not an SQL-support forum
Andrew Brown wrote:
This is a simple, ignorant question that arises from fooling with the new database. Just to get a feel of what it can do, I'm trying to get it to sort out my regular backup CDs and decide which can safely be thrown away because everythig on them is duplicated somewhere else.

So, assuming I have two tables, each consisting just of one column, disk names, how do I combine them into one column without duplicates in a new table?

INSERT INTO table_new SELECT DISTINCT name FROM table_old


And what is the mySQL syntax for saying, "I want all the entries in Table1.column2 that do not apear in table2.column2"? I guess it has something to do with joins, but I can't work it out at all from the mySQL documentation. The HSQLDB documentation is of course much worse.




It depends on the version you are using if you have 4.1 you could use a sub-query like this:


SELECT * FROM table1 WHERE column2 NOT IN( SELECT * FROM table2.colum2 )

If using older MySQL versions like 3.23 or 4.0 you have to use left join search the web for examples and take a loom into mysql-docs which are online at dev.mysql.com.

Tom


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to