Here's one option to "pivot" your results:
select
record_id
,max(soi) as soi
,max(heading) as heading
,max(description) as description
,max(relloc) as relloc
from
(select
record_id
,if(field_name = 'SOI', field_value, '') as soi
,if(field_name = 'Heading', field_va
Hi!
Andre Polykanine wrote:
> Hello Rolando,
>
> So if I do
> "INSERT IGNORE INTO `Votes` SET `EntryId`='12345', UserId`='789'";
> it *won't* insert the second row if there's a row with EntryId set to
> 12345 and UserId set to 789?
If you want to have at most one vote per user on any entry, IM
m: Andre Polykanine [mailto:an...@oire.org]
Sent: Monday, February 14, 2011 3:40 PM
To: Rolando Edwards
Cc: João Cândido de Souza Neto; mysql@lists.mysql.com
Subject: Re: Insert only if the entry doesn't exist
Hello Rolando,
Sorry, but if I do INSERT IGNORE INTO, then I must indicate
nine [mailto:an...@oire.org]
Sent: Monday, February 14, 2011 3:40 PM
To: Rolando Edwards
Cc: João Cândido de Souza Neto; mysql@lists.mysql.com
Subject: Re: Insert only if the entry doesn't exist
Hello Rolando,
Sorry, but if I do INSERT IGNORE INTO, then I must indicate a key
(typically a unique
5307 (Work)
201-660-3221 (Cell)
AIM & Skype : RolandoLogicWorx
redwa...@logicworks.net
http://www.linkedin.com/in/rolandoedwards
-Original Message-
From: João Cândido de Souza Neto [mailto:j...@consultorweb.cnt.br]
Sent: Monday, February 14, 2011 1:39 PM
To: mysql@lists.mysql.com
(Work)
201-660-3221 (Cell)
AIM & Skype : RolandoLogicWorx
redwa...@logicworks.net
http://www.linkedin.com/in/rolandoedwards
-Original Message-
From: João Cândido de Souza Neto [mailto:j...@consultorweb.cnt.br]
Sent: Monday, February 14, 2011 1:39 PM
To: mysql@lists.mysql.com
Su
Instead of "insert into" you can use "replace into".
--
João Cândido de Souza Neto
"Andre Polykanine" escreveu na mensagem
news:1621362474.20110214201...@oire.org...
Hi all,
Thanks for your fast answer to my last question!
Here's one more problem I commonly deal with.
There are cases when
杨涛涛
*Stop top posting.*
*
*
*thanks.*
*
*
On Thu, Dec 23, 2010 at 12:16 AM, 杨涛涛 wrote:
> Hi.
> I think if there are not some concurrency visitors, you should not use it.
> Otherwise, just put it.
> David Yeung, In China, Beijing.
> My First Blog:http://yueliangdao0608.cublog.cn
> My
Hi.
I think if there are not some concurrency visitors, you should not use it.
Otherwise, just put it.
David Yeung, In China, Beijing.
My First Blog:http://yueliangdao0608.cublog.cn
My Second Blog:http://yueliangdao0608.blog.51cto.com
My Msn: yueliangdao0...@gmail.com
2010/12/1 Wagner Bianchi
I'll provide it to, bear with me, pls...
Best regards.
--
WB
2010/11/30 Johan De Meersman
> Interesting, but I feel the difference is rather small - could you rerun
> with, say, 50.000 queries ? Also, different concurrency levels (1, 100)
> might be interesting to see.
>
> Yes, I'm to lazy to
Interesting, but I feel the difference is rather small - could you rerun
with, say, 50.000 queries ? Also, different concurrency levels (1, 100)
might be interesting to see.
Yes, I'm to lazy to do it myself, what did you think :-p
On Tue, Nov 30, 2010 at 4:01 PM, Wagner Bianchi
wrote:
> Friends,
Friends, I did a benchmark regarding to this subject.
Please, I am considering your comments.
=> http://wbianchi.wordpress.com/2010/11/30/insert-x-insert-delayed/
Best regards.
--
WB
2010/11/30 Wagner Bianchi
> Maybe, the table in use must be a table that is inside cache now - SHOW
> OPEN TABL
Maybe, the table in use must be a table that is inside cache now - SHOW OPEN
TABLES, controlled by table_cache, I mean.
Well, if the amount of data trasactioned is too small as a simple INSERT,
you don't have to be worried, I suggest. If you partition the table, we must
a benchmark to know the per
I would assume that it's slower because it gets put on the delay thread
anyway, and thus executes only whenever that thread gets some attention. I'm
not sure wether there are other influencing factors.
I should also think that "not in use" in this context means "not locked
against inserts", so the
What I'm confused by though, is this line.
"Note that INSERT DELAYED is slower than a normal INSERT if the table is not
otherwise in use." What's the definition of "in use"? Does a logging table
do that given that it's pretty much append-only/write-only?
Waynn
On Mon, Nov 29, 2010 at 10:19 PM,
No, I think it's a good idea to do INSERT DELAYED here - it's only logging
application, and it's generally more important to not slow down the
application for that. It's only ever into a single table, so there's only
going to be a single delay thread for it anyway.
Archive tables are a good idea,
Well, analyze if you need to create an excessive overhead into the MySQL
Server because a simple INSERT. What you must have a look is it:
- How much data this connection is delivering to MySQL's handlers?
- A word DELAYED in this case is making MySQL surfer?
Perhaps, you are sophisticating
> -Original Message-
> From: Dan Nelson [mailto:dnel...@allantgroup.com]
> Sent: Wednesday, September 29, 2010 2:26 PM
> To: Daevid Vincent
> Cc: 'MySQL'
> Subject: Re: INSERT DELAYED and created_on timestamps
>
> In the last episode (Sep 29), Daevi
In the last episode (Sep 29), Daevid Vincent said:
> I'm doing some reading on INSERT DELAYED
> http://dev.mysql.com/doc/refman/5.0/en/insert.html
>
> I have a user_log table:
>
> CREATE TABLE `user_log` (
> `id_user_log` bigint(20) unsigned NOT NULL auto_increment,
> `id_user` int(10) unsign
On 7/26/2010 2:30 AM, Manasi Save wrote:
Hi All,
I need to insert Blob data in my table using prepared statements. But
Whenever I try to insert it using prepared statement it is giving me
mysql syntax error.
Here's the prepared statement :-
SET @stmt = Concat(Insert into ',mydb,'.MyTable(
Awesome - thanks all for that clarification!
-Original Message-
From: Michael Dykman [mailto:mdyk...@gmail.com]
Sent: Wednesday, June 30, 2010 1:42 PM
To: David Stoltz
Cc: mysql@lists.mysql.com
Subject: Re: INSERT with auto increment
generally, it is:
INSERT INTO TABLE1 (fieldname
From: "David Stoltz"
In mySQL, if I expressly give it a value, like "INSERT INTO TABLE1
VALUES(17,'stuff')" - it works fine. But if I remove the 17, it says I
don't have a matching number of columns.
Use NULL for the autoinsert column.
I made it a rule to forbear all direct c
You can choose between:
INSERT INTO TABLE1 VALUES (null,'stuff')
or
INSERT INTO TABLE1 (stuffField) VALUES ('stuff')
--
João Cândido de Souza Neto
""David Stoltz"" escreveu na mensagem
news:487e7d0857fe094590bf2dc33fe3e1080a102...@shhs-mail.shh.org...
Hi All,
In MS SQL, if the table ha
generally, it is:
INSERT INTO TABLE1 (fieldname [ , fieldname]* ) VALUES (value[, value]*)
If you don't list the columns, it assumes you are inserting all of them, so:
INSERT INTO TABLE1 (mycolumn ) VALUES ('stuff')
This will also work
INSERT INTO TABLE1 VALUES (0, 'stuff')
the auto-incremen
Chris.
Thanks for your response. I read somewhere that the mysqli was better, so I
have been using it.
This exercise is an experiment, on my local machine only, so I ommitted any
escape functions. I am trying to create DB's with multiple tables, so it is
totally a learning exercise.
So hopef
Colin
Thank you for your reply. I had previously found the page you linked in
your original post, however at this stage of my development, my imagination
creates error messages and not inovative solutions.
I have found some other issues that are presenting road blocks, once I solve
them, I wi
I have no idea how you got here but there is no reason to do it that
way. This will work just fine and I do it every day in php.
However I don't use mysqli I still use ...
mysql_connect
mysql_select_db
mysql_real_escape_string
mysql_query
Don't forget to use the mysql_real_escape_string funct
Normally I would avoid getting into this sort of argument ( The 'OMG someone on
teh internets are
wrong!!' argument)
But in this case, the solution ( still the first result in a google search) is
far more efficient than
closing a connection so you can insert into another table.
You are correc
Michael
Thank you for your response. It gave me the idea how to solve this, and it
seemed to have worked!
For those following hoping to see a solution, what I did was open the
connection, insert into one table, closed the connection, closed the php
script, and the data was inserted into 2 of
It is not a question of multiple tables, it is a question of multiple
statements. Most PHP configurations prohibit the application of more
than one statement per call to execute. This is generally thought to
be a security issue as the vast majority of simple PHP-based SQL
injection attacks only w
Seriously
You should read your answers before you post, the SA link did not provide
the answer. Had you read the page you sent, you would notice it does not
apply to mulitple tables...
Gary
"Colin Streicher" wrote in message
news:201004112310.16594.co...@obviouslymalicious.com...
> Serious
Seriously...
I found the answer in the first result.
http://lmgtfy.com/?q=mysqli+multiple+insert+statements
Assuming mysqli, if you are using a different driver, then google that
Colin
On April 11, 2010 10:36:41 pm viraj wrote:
> is it mysqli query or 'multi_query'?
>
> http://php.net/manual/e
is it mysqli query or 'multi_query'?
http://php.net/manual/en/mysqli.multi-query.php
~viraj
On Sun, Apr 11, 2010 at 10:27 PM, Gary wrote:
> I am experimenting with multiple tables, it is only a test that is my local
> machine only. This is the current code, which does not work , I have tried
>
At 12:09 AM 11/28/2009, Krishna Chandra Prajapati wrote:
Hi Mos,
In the below two command does 1 is faster than 2.
1. LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet;
2. LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet LINES TERMINATED
BY '\r\n' enclosed by '"';
Thanks,
Krishna
Hi Mos,
In the below two command does 1 is faster than 2.
*
1. LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet;*
2. *LOAD DATA LOCAL INFILE '/path/pet.txt' INTO TABLE pet* *LINES
TERMINATED BY '\r\n' enclosed by '"';*
Thanks,
Krishna Ch. Prajapati
On Sat, Nov 28, 2009 at 3:50 AM, mos
At 07:40 AM 11/27/2009, Krishna Chandra Prajapati wrote:
Hi Experts,
load data local infile and insert into are the two methods of
inserting data into a mysql table.
Out of the above two method. Is there any faster method of inserting data
into mysql tables.
No. Load Data is the fastest meth
Nope, nothing you can do on the server end. The server will only
accept syntactically correct SQL statement and broken strings will
undermine that.
In practice, if you are careful to at least escape the quotes (ie '
--> \' ), you can avoid nasty SQL injection attacks, although some
statements m
Yes, there are plenty of smart ways to deal with this. Each of them
is somewhat dependant on whatever general purpose programming language
you are using and/or the environment you are working in.
In PHP we have mysql_escape_string() or PDO, in perl and Java, among
others, prepared statements are
>-Original Message-
>From: Sydney Puente [mailto:sydneypue...@yahoo.com]
>Sent: Friday, October 30, 2009 10:36 AM
>To: mysql@lists.mysql.com
>Subject: Re: insert warning - how to look at
>
>Thanks johan,
>Very useful - it seems so obvious now!
>There is
Thanks johan,
Very useful - it seems so obvious now!
There is an associated problem with transferring data into mysql.
because if the application pushing the data finds a warning it just silently
stops.
anyway I can detect a warning 1265 Data truncated on the mysqldb?
and make this visible - at wo
Hi,
mysql> show warnings;
BR
johan
Sydney Puente wrote:
Hello,
I have an application which is inserting rows into a Mysql 5.024 db.
It seems to stop when an insert generates a warning.
when I insert the suspect line on the mysql commandline I get this:
Query OK, 1 row affected, 1 warning (0.0
44 PM
>To: Jerry Schwartz
>Cc: Ray;
>Subject: Re: insert random number into table
>
>I always maintain a timestamp in my random numbers. As long as my
>precision is higher than my requests per second, wouldn't I be safe
>from collisions? Assuming a time machine is not inven
On October 16, 2009 12:29:42 pm Jerry Schwartz wrote:
> >-Original Message-
> >From: Ray [mailto:r...@stilltech.net]
> >Sent: Friday, October 16, 2009 1:10 PM
> >To: mysql@lists.mysql.com
> >Subject: Re: insert random number into table
> >
> >On O
I always maintain a timestamp in my random numbers. As long as my
precision is higher than my requests per second, wouldn't I be safe
from collisions? Assuming a time machine is not invented.
--
Scott
Iphone says hello.
On Oct 16, 2009, at 11:29 AM, "Jerry Schwartz" > wrote:
JS] Just remem
In addition to what Gavin said. You seem to want some form of key
perhaps to be able to identify the authenticity of your contest
winner. An auto increment ID won't be very secure for that, but you
still need it.
Take a known combination of perhaps the key, name, email address, etc,
and r
>-Original Message-
>From: Ray [mailto:r...@stilltech.net]
>Sent: Friday, October 16, 2009 1:10 PM
>To: mysql@lists.mysql.com
>Subject: Re: insert random number into table
>
>On October 16, 2009 10:57:48 am Jerry Schwartz wrote:
>> There is a RAND function i
Don't try to give them a random number, instead use a table with a primary key
that is AUTO_INCREMENT. Then you just insert the record, and afterwards SELECT
LAST_INSERT_ID(); to retrieve the id for the record created.
With random numbers, you're going to have more collisions when you add more
On October 16, 2009 10:57:48 am Jerry Schwartz wrote:
> There is a RAND function in MySQL, but if you need to guarantee that the
> identifiers are unique you should consider using an auto-increment field.
>
> If that isn't unique enough, you can use the UUID or UUID_SHORT functions.
> Theoretically
There is a RAND function in MySQL, but if you need to guarantee that the
identifiers are unique you should consider using an auto-increment field.
If that isn't unique enough, you can use the UUID or UUID_SHORT functions.
Theoretically, those should return values that are unique across the Inter
On Tue, Feb 24, 2009 at 8:53 PM, PJ wrote:
> Is there a way to insert several rows into a table with one statement?
> I have this:
> $sql2 = "INSERT INTO authors
>(first_name, last_name, ordinal) VALUES
> ('$first_nameIN', '$last_nameIN', '1')";
>$result2 = mysql_query(
> Hey guys,
>
> I am trying to construct a specially crafted view for the powerdns
> DNS-Server.
> This is what I have so far:
> CREATE VIEW test4 AS SELECT nummer AS name, ip as content FROM
> jabix.spaces JOIN jabix.ves ON spaces.veid = ves.id;
Wouldn't this work?
CREATE VIEW test4 (name, co
You can add a column to a view like this:
CREATE VIEW test4 AS SELECT nummer AS name, ip as content, 1 as domain_id
FROM jabix.spaces JOIN jabix.ves ON spaces.veid = ves.id;
This will set the domain_id vaulues to 1
Olaf
On 10/14/08 8:18 AM, "Samuel Vogel" <[EMAIL PROTECTED]> wrote:
> Hey guys,
This is exactly what I tried to avoid by using a view. I do not want to have
to take care about synchronizing two tables.
Is there any way to avoid this?
Regards,
Samy
Hi Samuel,
I am not sure if you can add a new column to a view, but why dont u create a
new table test4 as
create table test4 AS SELECT nummer AS name, ip as content FROM jabix.spaces
JOIN jabix.ves ON spaces.veid = ves.id;
And then add the new column to test4. When ever any new data is added int
On Mon, Jul 21, 2008 at 2:43 PM, mos <[EMAIL PROTECTED]> wrote:
> I thought if MySQL found a duplicate key on the insert, it would
> automatically update the existing row that it found with the results from
> table1 if I left out the column expressions in the update clause. But
> apparently it doe
At 12:16 PM 7/21/2008, you wrote:
So just use REPLACE instead of INSERT...
Sure, but a Replace will delete the existing row and insert the new one
which means also maintaining the indexes. This will take much longer than
just updating the existing row. Now if there were only a couple of ro
So just use REPLACE instead of INSERT...
http://dev.mysql.com/doc/refman/5.0/en/replace.html
On Mon, Jul 21, 2008 at 11:44 AM, mos <[EMAIL PROTECTED]> wrote:
> At 08:23 PM 7/20/2008, Perrin Harkins wrote:
>
>> On Sun, Jul 20, 2008 at 12:12 AM, mos <[EMAIL PROTECTED]> wrote:
>> > Is there a way t
At 11:00 AM 7/21/2008, Perrin Harkins wrote:
On Mon, Jul 21, 2008 at 11:44 AM, mos <[EMAIL PROTECTED]> wrote:
> I can't specify all of the columns in a Set statement in the
> OnDuplicate clause because I don't know what the column names are and there
> could be 100 columns.
Write code to d
On Mon, Jul 21, 2008 at 11:44 AM, mos <[EMAIL PROTECTED]> wrote:
> I can't specify all of the columns in a Set statement in the
> OnDuplicate clause because I don't know what the column names are and there
> could be 100 columns.
Write code to do it. There is no way around specifying the co
At 08:23 PM 7/20/2008, Perrin Harkins wrote:
On Sun, Jul 20, 2008 at 12:12 AM, mos <[EMAIL PROTECTED]> wrote:
> Is there a way to get "Insert ... select ... On Duplicate Update" to
update
> the row with the duplicate key?
That's what it does.
> Why can't it do this?
What makes you think it
On Sun, Jul 20, 2008 at 12:12 AM, mos <[EMAIL PROTECTED]> wrote:
> Is there a way to get "Insert ... select ... On Duplicate Update" to update
> the row with the duplicate key?
That's what it does.
> Why can't it do this?
What makes you think it can't?
- Perrin
--
MySQL General Mailing List
On Wed, Jul 9, 2008 at 9:37 AM, Phil <[EMAIL PROTECTED]> wrote:
> Is it possible to do an insert into with subselect and group by with an
> additional on duplicate insert ?
>
> CREATE TABLE NEW_TABLE (
> `a` varchar(10),
> `b` double
> ) engine=MyISAM;
>
>
> INSERT INTO NEW_TABLE (select old.x,su
Sorry, that was just a typo,
should have been
INSERT INTO NEW_TABLE (select old.x,sum(old.y) from OLD_TABLE old group by
old.x)
on duplicate key
update b=sum(old.y);
but this gives
ERROR (HY000): Invalid use of group function
INSERT INTO NEW_TABLE (select old.x,sum(old.y) from OLD_TAB
you should say "group by old.x" and not "old.a"
On 7/9/08, Arthur Fuller <[EMAIL PROTECTED]> wrote:
>
> I think that you need to select old.a otherwise you cannot group by it.
>
> Arthur
>
> On 7/9/08, Phil <[EMAIL PROTECTED]> wrote:
> >
> > Is it possible to do an insert into with subselect and g
I think that you need to select old.a otherwise you cannot group by it.
Arthur
On 7/9/08, Phil <[EMAIL PROTECTED]> wrote:
>
> Is it possible to do an insert into with subselect and group by with an
> additional on duplicate insert ?
>
> CREATE TABLE NEW_TABLE (
> `a` varchar(10),
> `b` double
On Thu, 3 Apr 2008, Hiep Nguyen wrote:
hi all, i have a question on insert ... select statement.
tbl_1(fld1,fld2,fld3, )
fld1 int primary key auto_increment not null
tbl_2(fld_a,fld_b,fld_c,...)
how do i construct my select statement so that fld1 is auto increment?
insert into tbl_1(fld
The beauty of this language is exactly as Johan says, you can skip the
obvious, Just insert all the other non-obvious columns. In the event that
you have numerous defaulted columns, though, it's best to supply a NULL so
the syntax is parallel (IMO), or alternatively to name the columns. But
either
Hi Hiep,
Hiep Nguyen skrev:
On Thu, 3 Apr 2008, Johan Höök wrote:
Hi Hiep,
you can put in either xxx = NULL
or you can skip it completely:
insert into tbl_1(fld2,fld3) select fld_b, NOW() from tbl_2;
Regards,
/Johan
Hiep Nguyen skrev:
hi all, i have a question on insert ... select stat
On Thu, 3 Apr 2008, Johan Höök wrote:
Hi Hiep,
you can put in either xxx = NULL
or you can skip it completely:
insert into tbl_1(fld2,fld3) select fld_b, NOW() from tbl_2;
Regards,
/Johan
Hiep Nguyen skrev:
hi all, i have a question on insert ... select statement.
tbl_1(fld1,fld2,fl
Hi Hiep,
you can put in either xxx = NULL
or you can skip it completely:
insert into tbl_1(fld2,fld3) select fld_b, NOW() from tbl_2;
Regards,
/Johan
Hiep Nguyen skrev:
hi all, i have a question on insert ... select statement.
tbl_1(fld1,fld2,fld3, )
fld1 int primary key auto_inc
Awesome!
Thanks Baron, works perfectly..
Phil
On Tue, Feb 26, 2008 at 10:06 PM, Baron Schwartz <[EMAIL PROTECTED]> wrote:
> Hi!
>
> On Tue, Feb 26, 2008 at 7:04 PM, Phil <[EMAIL PROTECTED]> wrote:
> > I have a table countrystats defined as
> >
> > CREATE TABLE IF NOT EXISTS `countrystats` (
>
Hi!
On Tue, Feb 26, 2008 at 7:04 PM, Phil <[EMAIL PROTECTED]> wrote:
> I have a table countrystats defined as
>
> CREATE TABLE IF NOT EXISTS `countrystats` (
> `proj` char(6) NOT NULL default '',
> `country` char(50) NOT NULL default '',
> `score` double default NULL,
> `nusers` int(11) d
Thanks it works great ! :)
Dan Buettner wrote :
Richard, it's possible, & your syntax is pretty close.
Try this:
INSERT INTO info_stamp
(fav_colour, hobby, stamp_date, firstname,
last_name, sexe, age, username, email, insc_date)
SELECT $fav_colour, $hobby, $time, a.firstname, a.last_name, a
Richard, it's possible, & your syntax is pretty close.
Try this:
INSERT INTO info_stamp
(fav_colour, hobby, stamp_date, firstname,
last_name, sexe, age, username, email, insc_date)
SELECT $fav_colour, $hobby, $time, a.firstname, a.last_name, a.sexe,
a.age, a.username, b.email, b.inscription_date
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 e
No, i dont see any other effect.
On 8/29/07, Krishna Chandra Prajapati <[EMAIL PROTECTED]> wrote:
>
> Hi Anand,
>
> Is there any other way it effects the queries.
>
> Regards,
> Krishna
>
> On 8/29/07, Ananda Kumar < [EMAIL PROTECTED]> wrote:
> >
> > Its all ways better to use integers without quo
Hi Anand,
Is there any other way it effects the queries.
Regards,
Krishna
On 8/29/07, Ananda Kumar <[EMAIL PROTECTED]> wrote:
>
> Its all ways better to use integers without quotes. It would effect
> execution plan of the sql.
>
> regards
> anandkl
>
>
> On 8/29/07, Krishna Chandra Prajapati <[E
Its all ways better to use integers without quotes. It would effect
execution plan of the sql.
regards
anandkl
On 8/29/07, Krishna Chandra Prajapati <[EMAIL PROTECTED]> wrote:
>
> hi all,
>
> create table stu (name varchar(20), roll int(2), id decimal(2));
>
> insert into stu values ('krishna',
Thanks Jay,
I had to make a change to the first part of the query to get the results that I
wanted but your suggestion was definitely what I needed to get to the solution.
Thanks again.
For those that are interested, here's the final solution,
INSERT INTO purchase (Source, Item, Qty)
SELEC
Ed Reed wrote:
Hi All,
I have an issue that I need to resolve that is difficult to explain. I
hope that someone can understand what I*m trying to do and shed some
light on a solution. Here goes.
I have three tables, inventory, which is a list of transactions with
positive and negative value
On 6/11/07, Baron Schwartz <[EMAIL PROTECTED]> wrote:
Hi,
Hamish Allan wrote:
> Hi,
>
> Is it possible to insert values into two tables simultaneously and
> have the value of one of the columns in the second table be the
> auto_increment value from inserting into the first?
No, because you can
Hi,
Hamish Allan wrote:
Hi,
Is it possible to insert values into two tables simultaneously and
have the value of one of the columns in the second table be the
auto_increment value from inserting into the first?
No, because you can only insert into one table at a time. But you can write a sto
> -Original Message-
> From: Philip Hallstrom [mailto:[EMAIL PROTECTED]
>
> Because if you wanted that you'd use REPLACE which is mysql
> specific which is okay since it's mysql you're using I guess.
Except for the CRITICAL issue that REPLACE will DELETE the row first,
thereby causing al
Maybe this is some SQL standard implementation and that's why it is what it
is, but to me it seems completely retarded that you have to explicitly call
out the columns...
http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html
Why doesn't it work in a more convenient and sane way?!
So i
Can you tell us what exactly is your problem ? ie returned error, logic,
or what ?
My first impression es that your insert is wrong, because inserts cant
have "where" conditions (it makes no sense) probably you want to do a
completely new insert including the column1 or maybe you want an
u
Without knowing where the values of column2, column3, and column4 are coming
from it's a little hard to say what the best technique would be. Usually one
would take the POSTed value from the select control and use it to retrieve
the related data from a table in your data base.
Regards,
Jerry Sch
So with a unique index on ItemI + AttributeID + Attribute_Value, this could
be the
statement:
INSERT INTO bm_ItemsAttributes (ItemID, AttributeID, Attribute_Value) IGNORE
SELECT DISTINCT(bmIA1.ItemID) FROM bm__ItemsAttributes bmIA1, '31',
'default text';
which should result in a new row co
So with a unique index on ItemI + AttributeID + Attribute_Value, this could
be the
statement:
INSERT INTO bm_ItemsAttributes (ItemID, AttributeID, Attribute_Value) IGNORE
SELECT DISTINCT(bmIA1.ItemID) FROM bm__ItemsAttributes bmIA1, '31',
'default text';
which should result in a new row co
Skip the whol SELECT part an create a unique index on the fields you want unique (AttributeID, Attribute_Value). Then just do an
INSERT IGNORE. The index will prevent a new non-unique from being entered and the IGNORE will prevent an error.
- Original Message -
From: "Miles Thompson" <[
INSERT INTO ztipos (type) VALUES (SELECT DISTINCT type FROM locais)
?
-afan
Miguel Vaz wrote:
Hi,
I have a table LOCAIS with:
idtypedesc
1t1blah blah
2t1uihuih
3t2pokpokp
I want to list only the distinct types and create a table
This may help you:
mysql> create table locais(
-> id int,
-> type varchar(2),
-> `desc` varchar(10));
Query OK, 0 rows affected (0.12 sec)
mysql> select * from locais;
+--+--+---+
| id | type | desc |
+--+--+---+
|1 | t1 | sk|
|2 | t2 | dsk |
Hi Ed,
Can you please reply with a repeatable test case?
On 2/1/07, Ed Pauley II <[EMAIL PROTECTED]> wrote:
I am importing a file into a table in which I want it to ignore
duplicate rows. When I specify --ignore (this also happens if I do a
SELECT IGNORE INTO from the client also) I get a dupli
The first to generate you sequence, then
second to populate the main table.
- Original Message -
From: "Ed Reed" <[EMAIL PROTECTED]>
To:
Sent: Friday, January 12, 2007 8:22 PM
Subject: Re: Insert ... Select troubles
Thanks for the suggestion Brent. The auto_increment won
to generate you sequence, then
second to populate the main table.
- Original Message -
From: "Ed Reed" <[EMAIL PROTECTED]>
To:
Sent: Friday, January 12, 2007 8:22 PM
Subject: Re: Insert ... Select troubles
Thanks for the suggestion Brent. The auto_increment won'
auto increment sequence to be made
for each record "group".
- Original Message -
From: "Ed Reed" <[EMAIL PROTECTED]>
To:
Sent: Friday, January 12, 2007 12:42 PM
Subject: Re: Insert ... Select troubles
> ItemCount is essentially a counter of the records fr
made for each
record "group".
- Original Message -
From: "Ed Reed" <[EMAIL PROTECTED]>
To:
Sent: Friday, January 12, 2007 12:42 PM
Subject: Re: Insert ... Select troubles
ItemCount is essentially a counter of the records from the select
statement. So, e
ItemCount is essentially a counter of the records from the select
statement. So, every new INSERT ... SELECT statement gets a new
GroupCount (the next number up) and ItemCount represents the ID of the
items in that new group.
Does that make sense?
- Thanks
>>> "Michael Dykman" <[EMAIL PROTECTE
On Friday 15 December 2006 11:53, Steve Edberg wrote:
> At 11:12 AM -0800 12/15/06, Chris Comparini wrote:
> >Hello,
> >
> >Say I wanted to log some various server status variables to
> >a table. What I'd like to do, ideally, is something like
> >this:
> >
> >insert into SomeLogTable (Threads) sho
At 11:12 AM -0800 12/15/06, Chris Comparini wrote:
Hello,
Say I wanted to log some various server status variables to
a table. What I'd like to do, ideally, is something like
this:
insert into SomeLogTable (Threads) show status like 'Threads_running';
MySQL does not allow this, of course. Bu
On Friday 15 December 2006 11:23, Mikhail Berman wrote:
> Hi Chris,
>
> If you are running on *Nix you could write a script generally structured
> like:
>
> do
> - show status | grep 'what_ever_string_you_want_to_see'
> - insert into table
> - sleep [seconds]
> done
>
Yes, we are
1 - 100 of 674 matches
Mail list logo