RE: INSERT WHERE NOT EXISTS syntax

2008-01-23 Thread roger.maynard
I think I sorted it out ... INSERT INTO master_comments (comment_no,comment_text,language_id) SELECT comment_no,comment_text,language_id from mComments WHERE NOT EXISTS ( SELECT comment_no FROM master_comments WHERE mComments.comment_no = master_comments.comment_no ); Hope this helps someone

INSERT WHERE NOT EXISTS syntax

2008-01-23 Thread roger.maynard
Can anyone tell me why this isn't working... v5.0 INSERT INTO master_comments (comment_no,comment_text,language_id) SELECT comment_no,comment_text,language_id from mComments WHERE NOT EXISTS (SELECT comment_no FROM master_comments); I thought I had it working once but now it

mysqldump - IF NOT EXISTS

2007-05-23 Thread Johannes Skov Frandsen
Hi Im contructing a build script and would like to dump my dev db with mysqldump so I can run a deploy script on the production server with the update db. I would like to construct the script so that it updates existing tables/fields/posts and add new tables/fields/post if they do not exists

RE: WHERE (NOT) EXISTS problem

2007-02-01 Thread Price, Randall
@lists.mysql.com Subject: Re: WHERE (NOT) EXISTS problem Michael Fischer wrote: > Having a very bad time with the subject sorts of queries. > Here is a simple reproduction of the problem for me. > Perhaps I'm blind/stupid while looking at the docs, > or there's a bug... > > m

RE: WHERE (NOT) EXISTS problem

2007-02-01 Thread Brown, Charles
PM To: mysql@lists.mysql.com Subject: WHERE (NOT) EXISTS problem Having a very bad time with the subject sorts of queries. Here is a simple reproduction of the problem for me. Perhaps I'm blind/stupid while looking at the docs, or there's a bug... mysql version 5.0.24-standard sim

Re: WHERE (NOT) EXISTS problem

2007-01-31 Thread Chris
ted to the people mapped to New York (michael, daniel)? No. Simple misunderstanding of the docs. EXISTS returns TRUE if it finds *any* result. http://dev.mysql.com/doc/refman/5.0/en/exists-and-not-exists-subqueries.html You want: select distinct name from people where pid in (select p

WHERE (NOT) EXISTS problem

2007-01-31 Thread Michael Fischer
Having a very bad time with the subject sorts of queries. Here is a simple reproduction of the problem for me. Perhaps I'm blind/stupid while looking at the docs, or there's a bug... mysql version 5.0.24-standard simple schema: mysql> desc people; +---+--+--+-+

Re: (mysqldump) CREATE TABLE IF NOT EXISTS. . .

2006-01-16 Thread Michael Williams
I appreciate the suggestion, but I'm not looking to drop anything. I only want it as a safety net in the event that the table doesn't already exist. I'm doing syncing of sorts, and I want the CREATE TABLE IF NOT EXISTS so as not to throw errors in the event that the table

Re: (mysqldump) CREATE TABLE IF NOT EXISTS. . .

2006-01-16 Thread Jake Peavy
DROP TABLE IF NOT EXISTS? On 1/16/06, Michael Williams <[EMAIL PROTECTED]> wrote: > > Hi All, > > Having a bit of mysqldump trouble again. I've looked over the > documentation (again) and can't seem to find the flag to make > 'mysqldump' out pu

(mysqldump) CREATE TABLE IF NOT EXISTS. . .

2006-01-16 Thread Michael Williams
Hi All, Having a bit of mysqldump trouble again. I've looked over the documentation (again) and can't seem to find the flag to make 'mysqldump' out put "CREATE TABLE IF NOT EXISTS". Any ideas? Regards, Michael -- MySQL General Mailing List For list ar

Re: add a column if not exists

2005-09-27 Thread Gleb Paharenko
Hello. You can parse the output of 'SHOW CREATE TABLE' or 'SHOW COLUMNS'. See: http://dev.mysql.com/doc/mysql/en/show-columns.html http://dev.mysql.com/doc/mysql/en/show-create-table.html Claire Lee wrote: > I want to check if a column exists in a table before I > do an alter ta

Re: add a column if not exists

2005-09-26 Thread Pooly
Hi, 2005/9/26, Peter Brawley <[EMAIL PROTECTED]>: > Claire, > > >I want to check if a column exists in a table before I > >do an alter table to add it. How do I do this in > >mysql? Thanks. other solution, do your query in all case and check for the return error (if any). mysql> alter table

Re: add a column if not exists

2005-09-26 Thread Peter Brawley
Claire, >I want to check if a column exists in a table before I >do an alter table to add it. How do I do this in >mysql? Thanks. If you are using MySQL 5.0, query information_schema.columns (http://dev.mysql.com/doc/mysql/en/columns-table.html) for the table and column. Otherwise use SHOW COL

add a column if not exists

2005-09-26 Thread Claire Lee
I want to check if a column exists in a table before I do an alter table to add it. How do I do this in mysql? Thanks. Claire __ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- MySQL Genera

Re: INSERT record IF NOT EXISTS?

2005-08-17 Thread Steve Edberg
At 7:10 PM -0700 8/17/05, Daevid Vincent wrote: Does mySQL have a way to INSERT a new record if one doesn't exist (based upon primary compound key)? I see this "EXISTS" but not an example of how to use it with INSERT. I see "INSERT... ON DUPLICATE KEY UPDATE col_name=expr" which is very close,

Re: INSERT record IF NOT EXISTS?

2005-08-17 Thread Paul DuBois
At 19:10 -0700 8/17/05, Daevid Vincent wrote: Does mySQL have a way to INSERT a new record if one doesn't exist (based upon primary compound key)? Isn't that how INSERT works already? If what you mean is that you want no error to occur, perhaps you want to use INSERT IGNORE instead. http://de

Re: INSERT record IF NOT EXISTS?

2005-08-17 Thread Jasper Bryant-Greene
Daevid Vincent wrote: Does mySQL have a way to INSERT a new record if one doesn't exist (based upon primary compound key)? I see this "EXISTS" but not an example of how to use it with INSERT. I see "INSERT... ON DUPLICATE KEY UPDATE col_name=expr" which is very close, but I want it to do nothin

INSERT record IF NOT EXISTS?

2005-08-17 Thread Daevid Vincent
Does mySQL have a way to INSERT a new record if one doesn't exist (based upon primary compound key)? I see this "EXISTS" but not an example of how to use it with INSERT. I see "INSERT... ON DUPLICATE KEY UPDATE col_name=expr" which is very close, but I want it to do nothing on duplicate key. :(

Create index if not exists????

2005-02-01 Thread Michael J. Pawlowsky
I'm writing an install script and need to create an index if it does not exists. I've tried SQL statements but none of them work. Basically I'm looking to do something like $sql[] = "ALTER TABLE `exp_members` ADD INDEX IF NOT EXIST `idx_members_username` ( `username` )

Re: INSERT if record NOT EXISTS

2004-07-27 Thread Harald Fuchs
In article <[EMAIL PROTECTED]>, Adaikalavan Ramasamy <[EMAIL PROTECTED]> writes: > This seems more like the solution I want. I am using perl-DBI and when > there is an error (i.e. duplicate insert), the rest of the scrip it not > executed. But this is gives me the following error. What am I doing

Re: INSERT if record NOT EXISTS

2004-07-26 Thread Marc Slemko
On Mon, 26 Jul 2004 17:47:37 +0100, Adaikalavan Ramasamy <[EMAIL PROTECTED]> wrote: > This seems more like the solution I want. I am using perl-DBI and when > there is an error (i.e. duplicate insert), the rest of the scrip it not > executed. But this is gives me the following error. What am I doin

Re: INSERT if record NOT EXISTS

2004-07-26 Thread Alec . Cawley
Adaikalavan Ramasamy <[EMAIL PROTECTED]> wrote on 26/07/2004 16:31:44: > But I have another related question. How do I write an IF ELSE command > with MYSQL. In this context, I want it to return myID if the record > already exists, otherwise insert into database. > > This naive syntax does not w

Re: INSERT if record NOT EXISTS

2004-07-26 Thread Adaikalavan Ramasamy
Yes, this does what I want and does not produce an error (which caused the remaining MYSQL syntax not to be executed). The firstname, lastname was for example only. In my problem, these are two different identifiers so I am not worried about multiple dual identifiers. Thanks to Keith Ivey, Alec Ca

Re: INSERT if record NOT EXISTS

2004-07-26 Thread Keith Ivey
Adaikalavan Ramasamy wrote: This naive syntax does not work : IF EXISTS (SELECT myID FROM tb WHERE firstname='Jack' AND lastname='Doe') ELSE (INSERT INTO tb(firstname, lastname) VALUES ('Jack', 'Doe'); Assuming you have the unique index on (firstname, lastname), just do INSERT IGNORE INTO tb (fir

Re: INSERT if record NOT EXISTS

2004-07-26 Thread Adaikalavan Ramasamy
> ... > If you specify the ON DUPLICATE KEY UPDATE clause (new in MySQL 4.1.0), > and a row is inserted that would cause a duplicate value in a UNIQUE index > or PRIMARY KEY, an UPDATE of the old row is performed. > ... > > > there is no IF NOT EXISTS syntax in INSERT

Re: INSERT if record NOT EXISTS

2004-07-26 Thread Michael Dykman
clause (new in MySQL 4.1.0), and a row is inserted that would cause a duplicate value in a UNIQUE index or PRIMARY KEY, an UPDATE of the old row is performed. ... there is no IF NOT EXISTS syntax in INSERT, but you could make use of the ON DUPLICATE KEY mechanism. Assuming you create a unique index

Re: INSERT if record NOT EXISTS

2004-07-26 Thread Adaikalavan Ramasamy
; > > +--+---+--+ > > | myID | firstname | lastname | > > +--+---+--+ > > |1 | John | Doe | > > |2 | Jack | Doe | > > |3 | John | Smith| > > +--+---+--+ > >

Re: INSERT if record NOT EXISTS

2004-07-26 Thread gerald_clark
); SELECT * from tb; +--+---+--+ | myID | firstname | lastname | +--+---+--+ |1 | John | Doe | |2 | Jack | Doe | |3 | John | Smith| +--+---+--+ I get syntax error with the following : INSERT INTO tb

Re: INSERT if record NOT EXISTS

2004-07-26 Thread Alec . Cawley
x27;Smith'); > SELECT * from tb; > +--+---+--+ > | myID | firstname | lastname | > +--+---+--+ > |1 | John | Doe | > |2 | Jack | Doe | > |3 | John | Smith| > +--+---+--+ > > I get syntax

INSERT if record NOT EXISTS

2004-07-26 Thread Adaikalavan Ramasamy
| |2 | Jack | Doe | |3 | John | Smith| +--+---+--+ I get syntax error with the following : INSERT INTO tb (firstname, lastname) VALUES ('Jack', 'Doe') IF NOT EXISTS ( SELECT * FROM tb WHERE firstname='Jack' AND lastname

RE: EXISTS/NOT EXISTS

2004-06-18 Thread Anton Ivanov
] Sent: Friday, June 18, 2004 2:38 PM To: Anton Ivanov Cc: [EMAIL PROTECTED] Subject: Re: EXISTS/NOT EXISTS Subqeries require mysql 4.1. The manual offers some suggestions on rewriting subqueries as JOINs <http://dev.mysql.com/doc/mysql/en/Rewriting_subqueries.html>. In your case, yo

Re: EXISTS/NOT EXISTS

2004-06-18 Thread Michael Stassen
product". I try SELECT product from products WHERE NOT EXISTS (SELECT DISTINCT * from products_by_product_areas WHERE products_by_product_areas.product = products.product); Both of these queries run fine on their own. It looks to me that I'm simply adapting from the manual, but all I g

Re: EXISTS/NOT EXISTS

2004-06-18 Thread Andrew Pattison
PROTECTED]> Sent: Friday, June 18, 2004 10:16 PM Subject: EXISTS/NOT EXISTS Hi, I'm trying to figure out how to apply these from the manual, but to no avail. Is it possible that my version (4.0.18) does not implement these? I have two tables: products and products_by_product_area. Bot

EXISTS/NOT EXISTS

2004-06-18 Thread Anton Ivanov
Hi, I'm trying to figure out how to apply these from the manual, but to no avail. Is it possible that my version (4.0.18) does not implement these? I have two tables: products and products_by_product_area. Both have a field "product". I try SELECT product from products W

Re: CREATE TABLE IF NOT EXISTS behavior (should it add rows if the table doesn't exist?)

2004-03-02 Thread Paul DuBois
At 14:42 -0800 3/2/04, Mark Brunkhart wrote: I apologize if this has been discussed or reported as a bug (I searched a bit but couldn't find mention of it). When you create a table using the CREATE TABLE IF NOT EXISTS...SELECT syntax, what is the correct behavior if the table already exist

CREATE TABLE IF NOT EXISTS behavior (should it add rows if the table doesn't exist?)

2004-03-02 Thread Mark Brunkhart
I apologize if this has been discussed or reported as a bug (I searched a bit but couldn't find mention of it). When you create a table using the CREATE TABLE IF NOT EXISTS...SELECT syntax, what is the correct behavior if the table already exists? I had thought that no action at all wou

Re: WHERE NOT EXISTS

2004-02-09 Thread Michael Satterwhite
all class_name from classes that aren't > represented a specific year. > > So what I want as result is HD, DD, MD > I'm trying to use the following query: > > SELECT class_name FROM classes WHERE NOT EXISTS (SELECT * FROM champions > WHERE champions.class_name=classes.

Re: WHERE NOT EXISTS

2004-02-09 Thread Victoria Reznichenko
D, DD, MD > > I'm trying to use the following query: > > > SELECT class_name FROM classes WHERE NOT EXISTS (SELECT * FROM champions WHERE > champions.class_name=classes.class_name AND champions.year='1981') > > > ERRORREPORT: > > #1064 - You have an

Re: WHERE NOT EXISTS

2004-02-09 Thread AllesKunst.net ID GesmbH
- Original Message - From: "Carl Schéle, IT, Posten" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, February 09, 2004 3:05 PM Subject: WHERE NOT EXISTS I use php 4.1.1. mysql 3.23.49 and phpmyadmin 2.5.4 I have

WHERE NOT EXISTS

2004-02-09 Thread "Carl Schéle, IT, Posten"
) 1981 HS PETER 1981 DS ANNE What I want to do is to list all class_name from classes that aren't represented a specific year. So what I want as result is HD, DD, MD I'm trying to use the following query: SELECT class_name FROM classes WHERE NOT EXIS

Re: How 'if not exists' implemented in MySQL?

2004-01-08 Thread robert_rowe
Stored procedures are MySQL are real new so I don't have much experience with them yet. The manual does seem to include some good info but I haven't delved too deeply. MaxDB is actually a separate DB. It is a re-brand of SAP DB. You might look for SAP DB info. It would probably apply to MaxDB.

Re: How 'if not exists' implemented in MySQL?

2004-01-08 Thread Bing Du
to see if MySQL has already had such a kind of feature like 'if not exists' but may be implemented in a different way so I don't have to make my own workaround. The application software that accesses the backend database is a comercial software. We don't have the source code an

Re: How 'if not exists' implemented in MySQL?

2004-01-08 Thread robert_rowe
First, please be aware that MySQL 5.0 is an alpha release. It is very young and there may still be some unresolved issues. It is not generally recommended to use alpha releases in production situations. Besides, anything that can be done in a stored procedure can be implemented in client side c

How 'if not exists' implemented in MySQL?

2004-01-08 Thread Bing Du
Greetings, We're trying to migrate an application from MS SQL Sever 2000 to MySQL 5.0. Choosing version 5.0 of MySQL is because its support of stored procedure is needed. We have a stored procedure doing something as shown below on the MS SQL Server 2000: IF NOT EXISTS (SELECT stat

RE: NOT EXISTS

2003-12-15 Thread Curley, Thomas
Many thanks Chris -Original Message- From: Chris Elsworth [mailto:[EMAIL PROTECTED] Sent: 15 December 2003 11:22 To: Curley, Thomas Cc: [EMAIL PROTECTED] Subject: Re: NOT EXISTS On Mon, Dec 15, 2003 at 10:59:32AM -, Curley, Thomas wrote: > Guys > > Any idea why this query

Re: NOT EXISTS

2003-12-15 Thread Victoria Reznichenko
"Curley, Thomas" <[EMAIL PROTECTED]> wrote: > > Any idea why this query will not work in 4.0.13 > > select batch_id from BATCH > where NOT EXISTS (select 1 from TXN where TXN.batch_id =3D BATCH.batch_id= > ) > > You have an error in your SQL syntax n

Re: NOT EXISTS

2003-12-15 Thread Chris Elsworth
On Mon, Dec 15, 2003 at 10:59:32AM -, Curley, Thomas wrote: > Guys > > Any idea why this query will not work in 4.0.13 > > select batch_id from BATCH > where NOT EXISTS (select 1 from TXN where TXN.batch_id = BATCH.batch_id) > > You have an error in your SQL syn

NOT EXISTS

2003-12-15 Thread Curley, Thomas
Guys Any idea why this query will not work in 4.0.13 select batch_id from BATCH where NOT EXISTS (select 1 from TXN where TXN.batch_id = BATCH.batch_id) You have an error in your SQL syntax near 'EXISTS (select * from TXN where TXN.batch_id = BATCH.batch_id)' at line

Re: 'IF NOT EXISTS' ignored?

2003-09-29 Thread Hassan Schroeder
Director General: NEFACOMP wrote: To me, I think that is a bug and should be reported to MySQL. When the IF condition is false, it should break the rest of the statement. Exactly what I thought :-) and Antony Dovgal responded: For me this is not a bug, just poorly documented feature. So, Hassan

Re: 'IF NOT EXISTS' ignored?

2003-09-29 Thread Antony Dovgal
On Mon, 29 Sep 2003 16:02:23 +0200 "Director General: NEFACOMP" <[EMAIL PROTECTED]> wrote: > For me, I think he may use two statements: > 1. Create the table if it does not exist. > 2. Insert data if that will not create duplicates. Yep, IMHO this is the only solution. > Another alternative is to

Re: 'IF NOT EXISTS' ignored?

2003-09-29 Thread Director General: NEFACOMP
. /* This is the first instruction for creating the table */ CREATE TEMPORARY TABLE IF NOT EXISTS showcase ( PRIMARY KEY (product) ); /* This is the second instruction for dumping records */ INSERT IGNORE INTO showcase SELECT product FROM productList

Re: 'IF NOT EXISTS' ignored?

2003-09-29 Thread Antony Dovgal
On Mon, 29 Sep 2003 15:16:57 +0200 "Director General: NEFACOMP" <[EMAIL PROTECTED]> wrote: > Now, do you think I was right in my rephrasing? > To me, I think that is a bug and should be reported to MySQL. When the IF > condition is false, it should break the rest of the statement. > What is your v

Re: 'IF NOT EXISTS' ignored?

2003-09-29 Thread Director General: NEFACOMP
finds that the table *does* already exist. === Is there a problem with 'IF NOT EXISTS' in the following scenario? This statement creates the table as expected ... CREATE TEMPORARY TABLE IF NOT EXISTS showcase ( PRIMARY KEY (product)

Re: 'IF NOT EXISTS' ignored?

2003-09-29 Thread Antony Dovgal
On Mon, 29 Sep 2003 12:30:28 +0200 "Director General: NEFACOMP" <[EMAIL PROTECTED]> wrote: > It seems Victoria didn't understand the real problem: > > I think that query should be stopped as soon as the table exists. > But if it doesn't exist, the query should create it and insert some records. >

Re: 'IF NOT EXISTS' ignored?

2003-09-29 Thread Director General: NEFACOMP
lt;[EMAIL PROTECTED]> Sent: Monday, September 29, 2003 11:37 Subject: Re: 'IF NOT EXISTS' ignored? > Hassan Schroeder <[EMAIL PROTECTED]> wrote: > > Is there a problem with 'IF NOT EXISTS' in the following scenario? > > > > This stat

Re: 'IF NOT EXISTS' ignored?

2003-09-29 Thread Victoria Reznichenko
Hassan Schroeder <[EMAIL PROTECTED]> wrote: > Is there a problem with 'IF NOT EXISTS' in the following scenario? > > This statement creates the table as expected ... > > CREATE TEMPORARY TABLE IF NOT EXISTS >showcase ( >

'IF NOT EXISTS' ignored?

2003-09-27 Thread Hassan Schroeder
Is there a problem with 'IF NOT EXISTS' in the following scenario? This statement creates the table as expected ... CREATE TEMPORARY TABLE IF NOT EXISTS showcase ( PRIMARY KEY (product) ) SELECT product FROM productList .. but re-running it

Re: help on NOT EXISTS SQL query

2002-12-09 Thread Murad Nayal
ed say a > freezer: > > if you do > > select customer from table where purchase != "freezer" > > you'll get all the INSTANCES of customer purchasing something other than > a freezer. i.e. you'll get c1,c2,c3. although c1 did purchase a freezer. > > my b

Re: help on NOT EXISTS SQL query

2002-12-09 Thread Stefan Hinz, iConnect \(Berlin\)
Dear Murad, > I know you can emulate an 'exists' subquery with a join. but I just > can't think of a way to emulate a 'not exists' without a subquery. > probably due to my limited sql experience. any hints? You have probably tried something like SELECT ... WHE

Re: help on NOT EXISTS SQL query

2002-12-09 Thread Murad Nayal
; subquery with a join. but I just > > can't think of a way to emulate a 'not exists' without a subquery. > > probably due to my limited sql experience. any hints? > > You have probably tried something like SELECT ... WHERE IS NOT > NULL. To emulate a "not

Re: help on NOT EXISTS SQL query

2002-12-09 Thread Murad Nayal
all the INSTANCES of customer purchasing something other than a freezer. i.e. you'll get c1,c2,c3. although c1 did purchase a freezer. my best guess of how to do this in SQL was select distinct t1.customer from table as t1 where not exists (select NULL from table as t2 where t1.customer = t2

RE: help on NOT EXISTS SQL query

2002-12-09 Thread Adolfo Bello
SELECT * FROM table1 t1 LEFT OUTER JOIN table2 t2 ON t1.field1=t2.field2 WHERE t2.field2 IS NULL > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]] On Behalf Of Murad Nayal > Sent: Monday, December 09, 2002 11:38 AM > To: MySQL List > Subject:

help on NOT EXISTS SQL query

2002-12-09 Thread Murad Nayal
Hello all, I need to run query like (in mysql < ver.4): select * from table1 as t1 where not exists (select NULL from table2 as t2 where t1.field1 = t2.field1) I know you can emulate an 'exists' subquery with a join. but I just can't think of a way to emulate a 'not exi

re: replication and if not exists temporary tables

2002-11-28 Thread Victoria Reznichenko
mm.mysql-2.0.14 driver. patdc> I'm using MySQL 3.23.53. patdc> The SQL I then got is: patdc> 1. create temporary table if not exists patdc> Highscores_result ( position int, name varchar(255), patdc> country varchar(255), score int ) patdc>

replication and if not exists temporary tables

2002-11-28 Thread puckman
intervals in the ranks (I want to ask the question "show me position 200-300), I figured I needed to use a temporary table. All my tables are innodb tables. I'm doing this in Java using the mm.mysql-2.0.14 driver. I'm using MySQL 3.23.53. The SQL I then got is: 1. create t

Re: Alternative for NOT EXISTS

2002-10-13 Thread Michael T. Babcock
John Ragan wrote: >try corereader. it will run queries against your >mysql, oracle, and ms sql server (and anything else >laying around). you can switch between your servers >with a click. > > Am I the only one getting tired of these non-SQL related advertising responses? Feel free to pu

Re: Alternative for NOT EXISTS

2002-10-12 Thread John Ragan
ok. > At 10:10 -0400 10/11/02, Michael T. Babcock wrote: > >John Ragan wrote: > > > >>try corereader. it will run queries against your mysql, oracle, > >>and ms sql server (and anything else laying around). you can > >>switch between your servers with a click. > >> > >Am I the only one gett

Re: Alternative for NOT EXISTS

2002-10-12 Thread Paul DuBois
At 10:10 -0400 10/11/02, Michael T. Babcock wrote: >John Ragan wrote: > >>try corereader. it will run queries against your mysql, oracle, >>and ms sql server (and anything else laying around). you can >>switch between your servers with a click. >> >Am I the only one getting tired of these non-

Re: Alternative for NOT EXISTS

2002-10-11 Thread Michael T. Babcock
Victor Kirk wrote: >>If so, this should work: >> >> SELECT u.uname >> FROM users u >> LEFT JOIN team_members t ON u.user_id =3D t.user_id >>AND t.team_id =3D 7 >> WHERE t.team_id is NULL >> >> > >Perfect :-) thanks very much this query works perfectly, you are a star. > > I'd like

RE: Re: Alternative for NOT EXISTS

2002-10-11 Thread Victor Kirk
>> SELECT u.uname FROM users u >> WHERE NOT EXISTS (SELECT * FROM team_members=20 >> WHERE team_id =3D 7 AND user_id=3Du.user_id); >It sounds to me like you are trying to ask the database: > "Tell me all the users that aren't in te

Re: Alternative for NOT EXISTS

2002-10-10 Thread John Ragan
a lot of effort (my sql skills are almost no existent) I > have the following that works with Oracle. > > SELECT u.uname FROM users u > WHERE NOT EXISTS (SELECT * FROM team_members > WHERE team_id = 7 AND user_id=u.user_id); > > This doesn't work

Re: Alternative for NOT EXISTS

2002-10-10 Thread John Ragan
After a lot of effort (my sql skills are almost no existent) I > have the following that works with Oracle. > > SELECT u.uname FROM users u > WHERE NOT EXISTS (SELECT * FROM team_members > WHERE team_id = 7 AND user_id=u.user_id); > > This does

RE: Alternative for NOT EXISTS

2002-10-10 Thread Robert Citek
Hello Victor, At 04:30 PM 10/10/2002 +0100, Victor Kirk wrote: >>> Can anyone help me? Ideally I would like something that would >>> be portable to oracle/sql server. Efficiency is not an issue. > >> How about ... > >>SELECT * FROM teams >>LEFT JOIN users USING (team_id) >>WHERE u

RE: Alternative for NOT EXISTS

2002-10-10 Thread Jan Muszynski
>> After a lot of effort (my sql skills are almost no existent) I > >> have the following that works with Oracle. > >> > >> SELECT u.uname FROM users u > >> WHERE NOT EXISTS (SELECT * FROM team_members > >> WHERE team_id = 7

Re: Re: Alternative for NOT EXISTS

2002-10-10 Thread Rodney Broom
From: Victor Kirk <[EMAIL PROTECTED]> > SELECT u.uname FROM users u > WHERE NOT EXISTS (SELECT * FROM team_members=20 > WHERE team_id =3D 7 AND user_id=3Du.user_id); It sounds to me like you are trying to ask the database: "Tell me all the users t

Re: Alternative for NOT EXISTS

2002-10-10 Thread Paul DuBois
skills are almost no existent) I >have the following that works with Oracle. > >SELECT u.uname FROM users u > WHERE NOT EXISTS (SELECT * FROM team_members > WHERE team_id = 7 AND user_id=u.user_id); > >This doesn't work with MySQL :-( ... until M

re: Alternative for NOT EXISTS

2002-10-10 Thread Egor Egorov
fort (my sql skills are almost no existent) I VK> have the following that works with Oracle. VK> SELECT u.uname FROM users u VK> WHERE NOT EXISTS (SELECT * FROM team_members VK> WHERE team_id = 7 AND user_id=u.user_id); VK> This doesn't work with M

RE: Alternative for NOT EXISTS

2002-10-10 Thread Victor Kirk
) I >> have the following that works with Oracle. >> >> SELECT u.uname FROM users u >> WHERE NOT EXISTS (SELECT * FROM team_members >> WHERE team_id = 7 AND user_id=u.user_id); >> >> This doesn't work with MySQL :-( >>

Re: Alternative for NOT EXISTS

2002-10-10 Thread Peter Brawley
the following that works with Oracle. > > SELECT u.uname FROM users u > WHERE NOT EXISTS (SELECT * FROM team_members > WHERE team_id = 7 AND user_id=u.user_id); > > This doesn't work with MySQL :-( > > Can anyone help me? Ideally I would li

Alternative for NOT EXISTS

2002-10-10 Thread Victor Kirk
Oracle. SELECT u.uname FROM users u WHERE NOT EXISTS (SELECT * FROM team_members WHERE team_id = 7 AND user_id=u.user_id); This doesn't work with MySQL :-( Can anyone help me? Ideally I would like something that would be portable to oracle/sql server. Efficiency is n

Create table if not exists from mysqldump?

2002-10-04 Thread John Kelly
already exists with an error. An alternative solution is running a script on the dump file to replace all occurrences of " CREATE TABLE " with " CREATE TABLE IF NOT EXISTS " as suggested by Clayburn. Thanks again! John

Fwd: Create table if not exists from mysqldump?

2002-10-04 Thread Clayburn W. Juniel, III
Begin forwarded message: From: "Clayburn W. Juniel, III" <[EMAIL PROTECTED]> Date: Fri Oct 4, 2002 10:24:06 America/Phoenix To: "Clayburn W. Juniel, III" <[EMAIL PROTECTED]> Subject: Re: Create table if not exists from mysqldump? On Friday, Oct 4, 2002, at 0

Re: Create table if not exists from mysqldump?

2002-10-04 Thread Clayburn W. Juniel, III
On Thursday, Oct 3, 2002, at 20:41 America/Phoenix, John Kelly wrote: > Hi, I am trying to use mysqldump to dump the structure of a single > database > and want the output to make create table commands that include the IF > NOT > EXISTS switch so that when the file is i

re: Create table if not exists from mysqldump?

2002-10-04 Thread Victoria Reznichenko
John, Friday, October 04, 2002, 6:41:46 AM, you wrote: JK> Hi, I am trying to use mysqldump to dump the structure of a single database JK> and want the output to make create table commands that include the IF NOT JK> EXISTS switch so that when the file is imported into an existing database it JK>

Re: Create table if not exists from mysqldump?

2002-10-04 Thread Gerald R. Jensen
Kelly" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, October 04, 2002 5:19 AM Subject: Re: Create table if not exists from mysqldump? Hi, Do u mean when u take a dump you need to add before each table "drop table if exists" then here is the command. mysqldump -u -p

Re: Create table if not exists from mysqldump?

2002-10-04 Thread swati sandhya
p the > structure of a single database > and want the output to make create table commands > that include the IF NOT > EXISTS switch so that when the file is imported into > an existing database it > does not write over tables with the same name. Does > anyone know if this is >

Create table if not exists from mysqldump?

2002-10-03 Thread John Kelly
Hi, I am trying to use mysqldump to dump the structure of a single database and want the output to make create table commands that include the IF NOT EXISTS switch so that when the file is imported into an existing database it does not write over tables with the same name. Does anyone know if

Re: Significance of /*!32312 IF NOT EXISTS*/;

2002-07-09 Thread Jeremy Zawodny
On Tue, Jul 09, 2002 at 08:51:05PM -0700, Todd Cary wrote: > In my mysql dump of a DB using the -B switch, I get > > CREATE DATABASE /*!32312 IF NOT EXISTS*/ sfyc; > > What is the significance of /*!32312 IF NOT EXISTS*/ - the > "/*!32312"? Isn't the statement

Significance of /*!32312 IF NOT EXISTS*/;

2002-07-09 Thread Todd Cary
In my mysql dump of a DB using the -B switch, I get CREATE DATABASE /*!32312 IF NOT EXISTS*/ sfyc; What is the significance of /*!32312 IF NOT EXISTS*/ - the "/*!32312"? Isn't the statement commented out? With the CREATE TABLE, what happens if the table already exists? Tod

Re: Re: INSERT IF NOT EXISTS?

2002-05-28 Thread Victoria Reznichenko
Markus, Tuesday, May 28, 2002, 2:15:09 PM, you wrote: >> You can use IGNORE keyword in INSERT statement, but it's not quite the >> same as "INSERT IF NOT EXIST". If you specify IGNORE, any rows that >> duplicate an existing PRIMARY or UNIQUE key in the table >> will be ignored in INSERT: ML> Yes

Re: INSERT IF NOT EXISTS?

2002-05-28 Thread Markus Lervik
(feed the hungry filters: sql, query) On Monday 27 May 2002 2:14 pm, Victoria Reznichenko wrote: > ML> Is there a simple way to do something like INSERT IF NOT EXISTS, > ML> other than first doing a SELECT and checking if it returns any rows? > ML> If not, that would be pr

Re: INSERT IF NOT EXISTS?

2002-05-27 Thread Rob
4:59:30 PM, you wrote: > > ML> Is there a simple way to do something like INSERT IF NOT EXISTS, > ML> other than first doing a SELECT and checking if it returns any rows? > ML> If not, that would be pretty high up on my whish-list : ) > > You can use IGNORE keyword in I

Re: INSERT IF NOT EXISTS?

2002-05-27 Thread Victoria Reznichenko
Markus, Monday, May 27, 2002, 4:59:30 PM, you wrote: ML> Is there a simple way to do something like INSERT IF NOT EXISTS, ML> other than first doing a SELECT and checking if it returns any rows? ML> If not, that would be pretty high up on my whish-list : ) You can use IGNORE keyword

Re: INSERT IF NOT EXISTS?

2002-05-27 Thread João Paulo Vasconcellos
On Monday 27 May 2002 10:59, Markus Lervik wrote: > (filter fodder: sql, query) > > Hello group! > > > Quick question: > > Is there a simple way to do something like INSERT IF NOT EXISTS, > other than first doing a SELECT and checking if it returns any rows? > If not

INSERT IF NOT EXISTS?

2002-05-27 Thread Markus Lervik
(filter fodder: sql, query) Hello group! Quick question: Is there a simple way to do something like INSERT IF NOT EXISTS, other than first doing a SELECT and checking if it returns any rows? If not, that would be pretty high up on my whish-list : ) Cheers, Markus -- Markus Lervik Linux

Re: Stupid - I just can't get it (NOT IN or NOT EXISTS)

2002-05-14 Thread João Paulo Vasconcellos
On Monday 13 May 2002 17:49, John Doe wrote: > Simle query request: I want to display the ID for everyone in a table who > is NOT in a second table. > > so this is what I have come up with > > SELECT student.SID, student.firstName > FROM student > WHERE student.SID NOT IN > (SELECT msoccerros

Re: Stupid - I just can't get it (NOT IN or NOT EXISTS)

2002-05-13 Thread mos
At 03:49 PM 5/13/2002, you wrote: >Simle query request: I want to display the ID for everyone in a table who >is NOT in a second table. > >so this is what I have come up with > >SELECT student.SID, student.firstName >FROM student >WHERE student.SID NOT IN > (SELECT msoccerroster.SID > FR

RE: Stupid - I just can't get it (NOT IN or NOT EXISTS)

2002-05-13 Thread G r e g L a w r i e
page does what you are wanting. -Original Message- From: John Doe [mailto:[EMAIL PROTECTED]] Sent: Tuesday, 14 May 2002 7:27 To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Stupid - I just can't get it (NOT IN or NOT EXISTS) Well that is really dumb because on page: www.mysq

RE: Stupid - I just can't get it (NOT IN or NOT EXISTS)

2002-05-13 Thread Gurhan Ozen
TED]] Sent: Monday, May 13, 2002 5:57 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: Re: Stupid - I just can't get it (NOT IN or NOT EXISTS) Well that is really dumb because on page: www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html it gives me a manual page oh the syntax of how to use it.

RE: Stupid - I just can't get it (NOT IN or NOT EXISTS)

2002-05-13 Thread Gurhan Ozen
MySQL doesn't support Sub-Selects yet... http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html Gurhan -Original Message- From: John Doe [mailto:[EMAIL PROTECTED]] Sent: Monday, May 13, 2002 4:49 PM To: [EMAIL PROTECTED] Subject: Stupid - I just can't get it (NOT IN or

  1   2   >