Re: time stamp specific to columns

2015-04-14 Thread hsv
, MySQL already does much which the SQL programmer wants and cannot come at: An auto-updated column is automatically updated to the current timestamp when the value of any other column in the row is changed from its current value. An auto-updated column remains unchanged if all other columns

Re: Issue with timestamp columns while working with MySQL load data in file

2015-04-13 Thread hsv
On 2015/04/12 08:52, Pothanaboyina Trimurthy wrote: The problem is , as mentioned the load data is taking around 2 hours, I have 2 timestamp columns for one column I am passing the input through load data, and for the column DB_MODIFIED_DATETIME no input is provided, At the end of the load data

Issue with timestamp columns while working with MySQL load data in file

2015-04-12 Thread Pothanaboyina Trimurthy
Hi All, I am facing an issue with timestamp columns while working with MySQL load data in file, I am loading around a million records which is taking around 2 hours to complete the load data. Before get into more details about the problem, first let me share the table structure. CREATE TABLE

Re: time stamp specific to columns

2015-04-09 Thread hsv
the timestampy part to another table, and join them when needed. On 4/8/15 6:36 AM, Martin Mueller wrote: I understand how a timestamp column automatically changes when there is a change in a data row. Is it possible to limit the update to changes in particular columns? I have a table where I

Re: time stamp specific to columns

2015-04-09 Thread Michael Dykman
how a timestamp column automatically changes when there is a change in a data row. Is it possible to limit the update to changes in particular columns? I have a table where I care about changes in any of four different columns, but I don¹t care about changes in other columns or added columns

Re: time stamp specific to columns

2015-04-08 Thread Andrew Wallace
I think you'd have to do that with a trigger. On 4/8/15 6:36 AM, Martin Mueller wrote: I understand how a timestamp column automatically changes when there is a change in a data row. Is it possible to limit the update to changes in particular columns? I have a table where I care about changes

Re: time stamp specific to columns

2015-04-08 Thread Emil Oppeln-Bronikowski
W dniu 08.04.2015 o 17:42, Andrew Wallace pisze: I think you'd have to do that with a trigger. +1 for using triggers. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql

time stamp specific to columns

2015-04-08 Thread Martin Mueller
I understand how a timestamp column automatically changes when there is a change in a data row. Is it possible to limit the update to changes in particular columns? I have a table where I care about changes in any of four different columns, but I don¹t care about changes in other columns or added

Query with variable number of columns?

2014-10-08 Thread Jan Steinman
) AS `2008`, SUM(CASE WHEN YEAR(sales.Date)='2009' THEN sales.Total ELSE NULL END) AS `2009`, ... WHERE dynamic predicate that only has results in one year However, this pattern will often result in numerous empty columns -- empties that would not be there had the table not been pivoted. What

Re: Query with variable number of columns?

2014-10-08 Thread Peter Brawley
)='2008' THEN sales.Total ELSE NULL END) AS `2008`, SUM(CASE WHEN YEAR(sales.Date)='2009' THEN sales.Total ELSE NULL END) AS `2009`, ... WHERE dynamic predicate that only has results in one year However, this pattern will often result in numerous empty columns -- empties that would

Re: Query with variable number of columns?

2014-10-08 Thread hsv
2014/10/08 11:38 -0700, Jan Steinman However, this pattern will often result in numerous empty columns -- empties that would not be there had the table not been pivoted. 2014/10/08 16:42 -0500, Peter Brawley MySQL stored procedures are less incomplete, and can do it, but they're awkward

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-03 Thread Johan De Meersman
- Original Message - From: Johan De Meersman vegiv...@tuxera.be Subject: Re: SHOW FULL COLUMNS QUERIES hogging my CPU In any case, this is nothing that can be fixed on the database level. I may or may not have to swallow that :-p I've been hammering a munin plugin that graphs

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-03 Thread Jatin Davey
On 6/3/2014 4:47 PM, Johan De Meersman wrote: - Original Message - From: Johan De Meersman vegiv...@tuxera.be Subject: Re: SHOW FULL COLUMNS QUERIES hogging my CPU In any case, this is nothing that can be fixed on the database level. I may or may not have to swallow that :-p I've

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-03 Thread Jatin Davey
Connector/J and found the getColumns() method building a stringBuffer object which evetually runs this SHOW FULL COLUMNS queries. I have to look at my code where ever this method is called and make sure we dont do it. But i have not nailed this down. It is still just an assumption that i have

SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-02 Thread Jatin Davey
file was a whopping 4 GB is size. Upon analyzing the queries i found that there were a total of 30 million queries made to the Database out of which 10 million queries were only doing SHOW FULL COLUMN queries. The SHOW FULL COLUMN queries were of the format as below: SHOW FULL COLUMNS FROM

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-02 Thread Reindl Harald
of the format as below: SHOW FULL COLUMNS FROM `APIC_PHY_FABRIC_PHYSICAL_INTERFACE` FROM `db_private_admin` LIKE '%' This is causing considerable cpu usage in %user_time in my system fix your application - there is no single reason to run such queries 10 million times because the result won't change

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-02 Thread Jatin Davey
FULL COLUMN queries were of the format as below: SHOW FULL COLUMNS FROM `APIC_PHY_FABRIC_PHYSICAL_INTERFACE` FROM `db_private_admin` LIKE '%' This is causing considerable cpu usage in %user_time in my system fix your application - there is no single reason to run such queries 10 million times

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-02 Thread Michael Dykman
many columns? is it a table or a view? On Mon, Jun 2, 2014 at 10:21 AM, Jatin Davey jasho...@cisco.com wrote: On 6/2/2014 7:18 PM, Reindl Harald wrote: Am 02.06.2014 15:35, schrieb Jatin Davey: I am no expert with mysql and databases. Hence seeking out some help on this forum. Basically i

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-02 Thread Singer Wang
made to the Database out of which 10 million queries were only doing SHOW FULL COLUMN queries. The SHOW FULL COLUMN queries were of the format as below: SHOW FULL COLUMNS FROM `APIC_PHY_FABRIC_PHYSICAL_INTERFACE` FROM `db_private_admin` LIKE '%' This is causing considerable cpu usage

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-02 Thread Jatin Davey
as below: SHOW FULL COLUMNS FROM `APIC_PHY_FABRIC_PHYSICAL_INTERFACE` FROM `db_private_admin` LIKE '%' This is causing considerable cpu usage in %user_time in my system fix your application - there is no single reason to run

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-02 Thread Jatin Davey
100 million rows, this will still cause your query to visit a very large number of them. So, I would have to ask: how many records are in that table? How many columns? is it a table or a view? On Mon, Jun 2, 2014 at 10:21 AM, Jatin Davey jasho...@cisco.com wrote: On 6/2/2014 7:18 PM, Reindl

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-02 Thread Jatin Davey
million queries made to the Database out of which 10 million queries were only doing SHOW FULL COLUMN queries. The SHOW FULL COLUMN queries were of the format as below: SHOW FULL COLUMNS FROM `APIC_PHY_FABRIC_PHYSICAL_INTERFACE` FROM

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-02 Thread Morgan Tocker
Hi Jatin, On Jun 2, 2014, at 7:56 AM, Jatin Davey jasho...@cisco.com wrote: I found this blog while trying to find a fix for my problem. Thought it might be useful to share. Here it is: http://whirlpool.net.au/blog/5 To confirm - did you manage to fix your problem? I was about to

Re: SHOW FULL COLUMNS QUERIES hogging my CPU

2014-06-02 Thread Johan De Meersman
- Original Message - From: Jatin Davey jasho...@cisco.com Subject: Re: SHOW FULL COLUMNS QUERIES hogging my CPU Certain part of our code uses DataNucleas while other parts of the code A data persistence product... there's your problem. Persisting objects into a relational database

Troubles with creating indexes on float columns on MyISAM tables in MySQL 5.6.15 and MySQL 5.6.14 running on FreeBSD 8.4

2014-01-29 Thread Mikhail Berman
I got an interesting problem with creation of indexes on MyISAM tables in MySQL 5.6.15 and MySQL 5.6.14 running on FreeBSD 8.4 for float columns - I am not able to create indexes on these columns Indexes on all other columns work just fine The problem occur while I was loading data from MySQL

ALTER TABLE - correct way of adding columns?

2013-07-08 Thread Rafał Radecki
Hi All. I would like to change the layout of my production database, I would like to add a column to an existing table. As I think before the ALTER TABLE statement all access to the database should be denied/ended, then the ALTER TABLE should be performed, and then user/applications should be

Re: ALTER TABLE - correct way of adding columns?

2013-07-08 Thread Johan De Meersman
- Original Message - From: Rafał Radecki radecki.ra...@gmail.com I would like to change the layout of my production database, I would like to add a column to an existing table. As I think before the ALTER TABLE statement all access to the database should be denied/ended, then the

Re: ALTER TABLE - correct way of adding columns?

2013-07-08 Thread Rafał Radecki
Have you used pt-online-schema-change.html from http://www.percona.com/doc/percona-toolkit/2.0/pt-online-schema-change.html ? What do you think about this tool? Best regards, Rafal Radecki. 2013/7/8 Rafał Radecki radecki.ra...@gmail.com Hi All. I would like to change the layout of my

Re: Foreign key on multiple columns

2013-03-21 Thread Peter Brawley
On 2013-03-21 8:12 AM, Norah Jones wrote: I'm trying to create a foreign key on two columns but getting error... Here's what I tried: CREATE TABLE test2 ( ID INT NOT NULL AUTO_INCREMENT, col1 INT NOT NULL, col2 INT NOT NULL, PRIMARY KEY (ID), CONSTRAINT

Re: Foreign key on multiple columns

2013-03-21 Thread shawn green
On 3/21/2013 12:43 PM, Abhishek Choudhary wrote: CREATE TABLE test2 ( ID INT NOT NULL AUTO_INCREMENT, col1 INT NOT NULL, col2 INT NOT NULL, PRIMARY KEY (ID), CONSTRAINT fk FOREIGN KEY (col1, col2) REFERENCES test1(ID,

Re: Foreign key on multiple columns

2013-03-21 Thread Abhishek Choudhary
...@earthlink.net To: mysql@lists.mysql.com Cc: Sent: Thursday, 21 March 2013 8:14 PM Subject: Re: Foreign key on multiple columns On 2013-03-21 8:12 AM, Norah Jones wrote: I'm trying to create a foreign key on two columns but getting error... Here's what I tried:       CREATE TABLE test2

Re: Getting distinct values in diff columns

2012-11-22 Thread Mogens Melander
Something like: select aname,max(adate) group by aname; On Thu, November 22, 2012 11:06, sagar bs wrote: Hi all, I have the table with two columns(account_name and order_date). In the account_name col, some account names are only once and few account names are twice and few others are 3/4

RE: Accessing Column Aliases In Other Columns?

2012-10-06 Thread Jan Steinman
to calculated columns in other columns. I thought a column alias would do it, but apparently they're only for aggregation, like GROUP BY. Other than repeating the entire calculation, what techniques are available for accessing such a calculation? I'm calculating an electric bill, based on meter

Accessing Column Aliases In Other Columns?

2012-10-03 Thread Jan Steinman
I would like to refer to calculated columns in other columns. I thought a column alias would do it, but apparently they're only for aggregation, like GROUP BY. Other than repeating the entire calculation, what techniques are available for accessing such a calculation? I'm calculating

RE: Accessing Column Aliases In Other Columns?

2012-10-03 Thread Rick James
, October 03, 2012 4:09 PM To: mysql@lists.mysql.com Subject: Accessing Column Aliases In Other Columns? I would like to refer to calculated columns in other columns. I thought a column alias would do it, but apparently they're only for aggregation, like GROUP BY. Other than repeating the entire

Re: create alias for columns bound to database?

2012-05-21 Thread Johan De Meersman
- Original Message - From: Rick James rja...@yahoo-inc.com * should not begin with the table name Personally, I tend to prefix all column names with three-letter abbreviations of the table name, so that they are both unique across joins, and it's obvious what table they're from

RE: create alias for columns bound to database?

2012-05-21 Thread Rick James
, May 21, 2012 5:27 AM To: Rick James Cc: da...@lorenso.com; mysql@lists.mysql.com Subject: Re: create alias for columns bound to database? - Original Message - From: Rick James rja...@yahoo-inc.com * should not begin with the table name Personally, I tend to prefix all column

create alias for columns bound to database?

2012-05-18 Thread D. Dante Lorenso
All, I'd like to be able to create column aliases which are bound to the database itself. I have an assortment of columns without naming standards which i'd like to migrate to a better naming scheme. Is there a feature in MySQL that would allow me to give a database column multiple names

RE: create alias for columns bound to database?

2012-05-18 Thread David Lerer
@lists.mysql.com Subject: create alias for columns bound to database? All, I'd like to be able to create column aliases which are bound to the database itself. I have an assortment of columns without naming standards which i'd like to migrate to a better naming scheme. Is there a feature in MySQL

RE: create alias for columns bound to database?

2012-05-18 Thread Rick James
18, 2012 2:22 PM To: mysql@lists.mysql.com Subject: create alias for columns bound to database? All, I'd like to be able to create column aliases which are bound to the database itself. I have an assortment of columns without naming standards which i'd like to migrate to a better naming

Re: One inst has 39 columns- the other 40

2012-03-22 Thread Reindl Harald
Am 22.03.2012 05:41, schrieb Brown: Look man, there has to be someone out there that can tell me why one user table has 5 extra columns. Is it version related or my sysprog person missed out on a step. Its hard to believe that this problem is unique to my site. logically is it version

Re: tables do not have the same number of columns.

2012-03-22 Thread Johan De Meersman
*plonk* - Original Message - From: Charles Brown cbr...@bmi.com To: Reindl Harald h.rei...@thelounge.net Cc: MySql mysql@lists.mysql.com Sent: Thursday, 22 March, 2012 5:37:00 AM Subject: tables do not have the same number of columns. I have two mysql instances in my mysql cluster

Re: One inst has 39 columns- the other 40

2012-03-22 Thread Mark Goodge
On 22/03/2012 04:41, Brown, Charles wrote: Look man, there has to be someone out there that can tell me why one user table has 5 extra columns. As far as I can see, plenty of people already have told you. Is it version related or my sysprog person missed out on a step. Yes, it's related

RE: One inst has 39 columns- the other 40

2012-03-22 Thread Brown, Charles
: One inst has 39 columns- the other 40 Am 22.03.2012 05:41, schrieb Brown: Look man, there has to be someone out there that can tell me why one user table has 5 extra columns. Is it version related or my sysprog person missed out on a step. Its hard to believe that this problem is unique

Re: One inst has 39 columns- the other 40

2012-03-21 Thread Johan De Meersman
Brown cbr...@bmi.com, mysql@lists.mysql.com Sent: Wednesday, 21 March, 2012 6:27:17 AM Subject: RE: One inst has 39 columns- the other 40 I have two mysql instances in my mysql cluster. I noticed that their MysSQL.user tables do not have the same number of columns. Their USER table attributes

Re: One inst has 39 columns- the other 40

2012-03-21 Thread Reindl Harald
Am 21.03.2012 06:27, schrieb Brown: I have two mysql instances in my mysql cluster. I noticed that their MysSQL.user tables do not have the same number of columns. Their USER table attributes are not the same. One instance has 39 columns while the other has 42 columns. Can someone please

Re: One inst has 39 columns- the other 40

2012-03-21 Thread Rik Wasmus
You keep repeating that, and I already replied to it the first time. If my answer isn't acceptable, spamming the question isn't going to make it better - or make people more inclined to help you, for that matter. I concur -- Rik Wasmus -- MySQL General Mailing List For list archives:

tables do not have the same number of columns.

2012-03-21 Thread Brown, Charles
I have two mysql instances in my mysql cluster. I noticed that their MysSQL.user tables do not have the same number of columns. See below for their attributes. Is anyone out there has any idea why these tables are not the same? Can someone help me. Hostchar(60

RE: One inst has 39 columns- the other 40

2012-03-21 Thread Brown, Charles
Look man, there has to be someone out there that can tell me why one user table has 5 extra columns. Is it version related or my sysprog person missed out on a step. Its hard to believe that this problem is unique to my site. Hostchar(60)NO PRI Userchar(16

Re: One inst has 39 columns- the other 40

2012-03-21 Thread Nuno Tavares
Charles, You should run SELECT @@version on both nodes. It looks like you have different version' schemas. -NT Em 22-03-2012 04:41, Brown, Charles escreveu: Look man, there has to be someone out there that can tell me why one user table has 5 extra columns. Is it version related or my

Re: One inst has 39 columns- the other 40

2012-03-21 Thread Michael Dykman
. It looks like you have different version' schemas. -NT Em 22-03-2012 04:41, Brown, Charles escreveu: Look man, there has to be someone out there that can tell me why one user table has 5 extra columns. Is it version related or my sysprog person missed out on a step. Its hard to believe

RE: One inst has 39 columns- the other 40

2012-03-20 Thread Brown, Charles
I have two mysql instances in my mysql cluster. I noticed that their MysSQL.user tables do not have the same number of columns. Their USER table attributes are not the same. One instance has 39 columns while the other has 42 columns. Can someone please help me here. Could it be because I'm

Re: One inst has 39 columns- the other 40

2012-03-19 Thread Johan De Meersman
- Original Message - From: Charles Brown cbr...@bmi.com I have two mysql instances in my mysql cluster. I noticed that their MysSQL.user tables do not have the same number of columns. Their USER table attributes are not the same. One instance has 39 columns while the other has 42

One inst has 39 columns- the other 40

2012-03-19 Thread Brown, Charles
I have two mysql instances in my mysql cluster. I noticed that their MysSQL.user tables do not have the same number of columns. Their USER table attributes are not the same. One instance has 39 columns while the other has 42 columns. Can someone please help me here. Could it be because I'm

One inst has 39 columns- the other 40

2012-03-18 Thread Brown, Charles
I have two mysql instances in my mysql cluster. I noticed that their MysSQL.user tables do not have the same number of columns. Their USER table attributes are not the same. One instance has 39 columns while the other has 42 columns. Can someone please help me here. Could it be because I'm

Re: importing mysql structures only or restore ignoring non-existing tables and columns?

2011-10-31 Thread Luis Motta Campos
On 29 Oct 2011, at 22:59, luci spam wrote: I have 2 servers (1 for development, 1 for service) I keep ADD/DELETE columns and CREATE/DELETE Indexes on my development server, so these 2 server have similar but different mysql data structures. I know there's an option to expert structures

importing mysql structures only or restore ignoring non-existing tables and columns?

2011-10-29 Thread luci spam
I have 2 servers (1 for development, 1 for service) I keep ADD/DELETE columns and CREATE/DELETE Indexes on my development server, so these 2 server have similar but different mysql data structures. I know there's an option to expert structures only. (like –no-data) Is there a way (except 3rd

How do I get more pages in mySQL Workbench?? WAS: Any table visualization tools with wires connecting the actual columns?

2011-05-03 Thread Daevid Vincent
I just discovered that MySQL Workbench actually WILL connect columns. Use the #6 wire type shortcut (bottom one). However, I must be retarded or blind because I can't figure out how to make the diagram have more than the default of 2 pages. I have a database with 50 tables and they just don't

Re: Any table visualization tools with wires connecting the actual columns?

2011-04-12 Thread Martijn Tonies
connecting the actual columns? I am evaluating various tools for diagram generating of existing databases on some smaller databases (9 tables or so) first. The two I've tried so far are these: http://dev.mysql.com/downloads/workbench/ http://www.sqlmaestro.com/download/#mysql Both _seem_ robust

RE: Any table visualization tools with wires connecting the actual columns?

2011-04-08 Thread Daevid Vincent
@lists.mysql.com Subject: RE: Any table visualization tools with wires connecting the actual columns? At 05:36 PM 4/7/2011, Daevid Vincent wrote: I am a paid subscriber to SQLYog -- I love that tool, but AFAIK it doesn't do diagrams (with wires between tables and all that glory). Am I wrong

Re: Any table visualization tools with wires connecting the actual columns?

2011-04-08 Thread Johan De Meersman
- Original Message - From: Daevid Vincent dae...@daevid.com It only seems to do the lines for InnoDB tables, not MyISAM... I mean, it not only won't auto-connect them, it won't even allow ME to connect them. :( Probably because it wants to adhere to the engine capabilities, and

Any table visualization tools with wires connecting the actual columns?

2011-04-07 Thread Daevid Vincent
columns? I am evaluating various tools for diagram generating of existing databases on some smaller databases (9 tables or so) first. The two I've tried so far are these: http://dev.mysql.com/downloads/workbench/ http://www.sqlmaestro.com/download/#mysql Both _seem_ robust and cosmetically

Re: Any table visualization tools with wires connecting the actual columns?

2011-04-07 Thread Jason Trebilcock
on this? I've written to SQL Maestro twice and they've not replied either. From: Daevid Vincent [mailto:dae...@daevid.com] Sent: Friday, April 01, 2011 4:27 PM To: mysql@lists.mysql.com Subject: Any table visualization tools with wires connecting the actual columns? I am evaluating various

Re: Any table visualization tools with wires connecting the actual columns?

2011-04-07 Thread mos
to emails and forum posts. Mike From: Daevid Vincent [mailto:dae...@daevid.com] Sent: Friday, April 01, 2011 4:27 PM To: mysql@lists.mysql.com Subject: Any table visualization tools with wires connecting the actual columns? I am evaluating various tools for diagram generating of existing

RE: Any table visualization tools with wires connecting the actual columns?

2011-04-07 Thread Daevid Vincent
:36 PM To: mysql@lists.mysql.com Subject: Re: Any table visualization tools with wires connecting the actual columns? At 02:17 PM 4/7/2011, Daevid Vincent wrote: Does anyone have any suggestions on this? I've written to SQL Maestro twice and they've not replied either. Take a look

RE: Any table visualization tools with wires connecting the actual columns?

2011-04-07 Thread Daevid Vincent
@lists.mysql.com Subject: Re: Any table visualization tools with wires connecting the actual columns? Toad for MySQL can do the diagramming piece...but, it looks and feels like you might have some of the same frustrations with it as well. But, another tool worth exploring nonetheless. On Thu

RE: Any table visualization tools with wires connecting the actual columns?

2011-04-07 Thread mos
columns? At 02:17 PM 4/7/2011, Daevid Vincent wrote: Does anyone have any suggestions on this? I've written to SQL Maestro twice and they've not replied either. Take a look at SqlYog from www.webyog.com. I use their community version but their paid version has a schema designer

Any table visualization tools with wires connecting the actual columns?

2011-04-01 Thread Daevid Vincent
with what links to what -- that I tell it to. It's further exacerbated by the fact that the documentation indicates these aren't even REAL keys, they are cosmetic only! WTF? Why add confusion guys? 1. Neither one seem to be smart enough to automatically know that columns of the same name should

Re: Foreign key with more columns and a constant value

2010-10-24 Thread Johan De Meersman
, but only in combination with the column type. This is why I need to use a foreign key with 2 columns. Is there a solution for what I want, or I will need to add that extra column with unique values in all the tables that reference the table `constants`? Thank you. Octavian -- MySQL

Foreign key with more columns and a constant value

2010-10-23 Thread Octavian R��ni��
reference the table constants and in this table the IDs of the constants are not unique alone, but only in combination with the column type. This is why I need to use a foreign key with 2 columns. Is there a solution for what I want, or I will need to add that extra column with unique values

RE: Swap data in columns

2010-09-23 Thread Jangita
ALTER TABLE tablename1 CHANGE column1 column2 VARCHAR(64), CHANGE column2 column1 VARCHAR(64) Assuming the columns are varchar(64) Jangita | +254 76 918383 | MSN Y!: jang...@yahoo.com Skype: jangita | GTalk: jangita.nyag...@gmail.com -Original Message- From: nixofortune

Re: Swap data in columns

2010-09-23 Thread nixofortune
by row?) - Original Message - From: nixofortune nixofort...@googlemail.com To: mysql@lists.mysql.com Sent: Wednesday, September 22, 2010 5:29 PM Subject: Swap data in columns Hi all. Sorry for very simple question, just can't figure out the solution. I need to swap data

Swap data in columns

2010-09-22 Thread nixofortune
Hi all. Sorry for very simple question, just can't figure out the solution. I need to swap data in column1 with data in column2. ++-+-+ | id | column1 | column2 | ++-+-+ | 1 | a | z | | 2 | b | y | | 3 | c | x | | 4

RE: Swap data in columns

2010-09-22 Thread Rolando Edwards
@lists.mysql.com Subject: Swap data in columns Hi all. Sorry for very simple question, just can't figure out the solution. I need to swap data in column1 with data in column2. ++-+-+ | id | column1 | column2 | ++-+-+ | 1 | a | z | | 2 | b | y

Re: Swap data in columns

2010-09-22 Thread Johnny Withers
Couldn't you just rename the columns? JW On Wed, Sep 22, 2010 at 11:53 AM, Rolando Edwards redwa...@logicworks.netwrote: I ran these commands: use test DROP TABLE IF EXISTS mydata; CREATE TABLE mydata (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,column1 CHAR(1),column2 CHAR(2)); INSERT

Re: Swap data in columns

2010-09-22 Thread Steve Staples
What about: select `id`, `column1` as 'column2', `column2` as 'column1'; Steve On Wed, 2010-09-22 at 13:06 -0500, Johnny Withers wrote: Couldn't you just rename the columns? JW On Wed, Sep 22, 2010 at 11:53 AM, Rolando Edwards redwa...@logicworks.netwrote: I ran these commands

Re: Swap data in columns

2010-09-22 Thread nixofortune
: rolandologicworxredwa...@logicworks.nethttp://www.linkedin.com/in/rolandoedwards -Original Message- From: nixofortune [mailto:nixofort...@googlemail.com nixofort...@googlemail.com] Sent: Wednesday, September 22, 2010 12:30 PM To: mysql@lists.mysql.com Subject: Swap data in columns

Re: Swap data in columns

2010-09-22 Thread Egor Shevtsov
/in/rolandoedwards -Original Message- From: nixofortune [mailto:nixofort...@googlemail.com] Sent: Wednesday, September 22, 2010 12:30 PM To: mysql@lists.mysql.com Subject: Swap data in columns Hi all. Sorry for very simple question, just can't figure out the solution. I need to swap

Re: Swap data in columns

2010-09-22 Thread Johnny Withers
This is even better! JW On Wed, Sep 22, 2010 at 2:27 PM, Steve Staples sstap...@mnsi.net wrote: What about: select `id`, `column1` as 'column2', `column2` as 'column1'; Steve On Wed, 2010-09-22 at 13:06 -0500, Johnny Withers wrote: Couldn't you just rename the columns? JW

RE: Swap data in columns

2010-09-22 Thread Rolando Edwards
- From: Egor Shevtsov [mailto:nixofort...@googlemail.com] Sent: Wednesday, September 22, 2010 4:14 PM To: MySQL mailing list Subject: Re: Swap data in columns Hi Rolando, This is perfect solution I was looking for. Why do you use left join here? It looks like inner join works fine as well. Thanks

Re: Swap data in columns

2010-09-22 Thread Kevin (Gmail)
by row?) - Original Message - From: nixofortune nixofort...@googlemail.com To: mysql@lists.mysql.com Sent: Wednesday, September 22, 2010 5:29 PM Subject: Swap data in columns Hi all. Sorry for very simple question, just can't figure out the solution. I need to swap data in column1

MySQL SUM on two columns

2010-08-31 Thread Tompkins Neil
Hi, I've the following basic SUM for our products based on a rating. SELECT SUM(products.rating) AS products_rating FROM products_sales INNER JOIN products ON products_sales.products_id = products.products_id WHERE products.enabled = 1 AND products_sales.language = 'EN' This works fine, however

RE: MySQL SUM on two columns

2010-08-31 Thread misiaQ
I don't think that SUM will work for varchar columns. If I got your point right - you need to use WITH ROLLUP grouping http://dev.mysql.com/doc/refman/5.0/en/group-by-modifiers.html see second example on that page. regards, m -Original Message- From: Tompkins Neil [mailto:neil.tompk

Re: MySQL SUM on two columns

2010-08-31 Thread Tompkins Neil
Sorry I don't want to SUM the varchar columns. This is the parameter passed that defines the two different queries. On Tue, Aug 31, 2010 at 11:48 AM, misiaQ mis...@poczta.fm wrote: I don't think that SUM will work for varchar columns. If I got your point right - you need to use WITH ROLLUP

Re: MySQL SUM on two columns

2010-08-31 Thread John Daisley
SELECT products_sales.language, SUM(products.rating) AS products_rating FROM products_sales INNER JOIN products ON products_sales.products_id = products.products_id WHERE products.enabled = 1 AND products_sales.language IN ('EN','ES') GROUP BY products_sales.language Will give the sum for each

Re: MySQL SUM on two columns

2010-08-31 Thread Tompkins Neil
Perfect. Exactly what I was looking for. Cheers John. Regards, Neil On Tue, Aug 31, 2010 at 12:06 PM, John Daisley daisleyj...@googlemail.comwrote: SELECT products_sales.language, SUM(products.rating) AS products_rating FROM products_sales INNER JOIN products ON products_sales.products_id

Re: MySQL SUM on two columns

2010-08-31 Thread Tompkins Neil
Hi, I also wondered, if there is any way to LIMIT the products.rating for each language to say the top 25 ? Cheers Neil On Tue, Aug 31, 2010 at 12:11 PM, Tompkins Neil neil.tompk...@googlemail.com wrote: Perfect. Exactly what I was looking for. Cheers John. Regards, Neil On Tue, Aug

Retrieve three columns in sub query

2010-08-25 Thread Tompkins Neil
Hi Is it possible in MySQL 5.1 to retrieve three columns in a select sub-query like below : SELECT student_age, SELECT (student_subjects_id, random_mark, subject FROM student_subjects ORDER BY RAND(), LIMIT 1) FROM students WHERE student_age 10 ORDER BY RAND() LIMIT 1 I've looked and tried

Re: Retrieve three columns in sub query

2010-08-25 Thread Jo�o C�ndido de Souza Neto
columns in a select sub-query like below : SELECT student_age, SELECT (student_subjects_id, random_mark, subject FROM student_subjects ORDER BY RAND(), LIMIT 1) FROM students WHERE student_age 10 ORDER BY RAND() LIMIT 1 I've looked and tried everything, but nothing seems to work

Re: Retrieve three columns in sub query

2010-08-25 Thread Tompkins Neil
Souza Neto Tompkins Neil neil.tompk...@googlemail.com escreveu na mensagem news:aanlkti=djkujcsg=kf29sjsp0yllhmhb02mqzdvzd...@mail.gmail.com... Hi Is it possible in MySQL 5.1 to retrieve three columns in a select sub-query like below : SELECT student_age, SELECT (student_subjects_id

RE: Retrieve three columns in sub query

2010-08-25 Thread misiaQ
select ci.*, ct.* from (select name, countrycode from city) ci, country ct where ci.countrycode = ct.code Regards, m -Original Message- From: Tompkins Neil [mailto:neil.tompk...@googlemail.com] Sent: Wednesday, August 25, 2010 1:23 PM To: [MySQL] Subject: Retrieve three columns in sub

Re: Retrieve three columns in sub query

2010-08-25 Thread Jo�o C�ndido de Souza Neto
three columns in a select sub-query like below : SELECT student_age, SELECT (student_subjects_id, random_mark, subject FROM student_subjects ORDER BY RAND(), LIMIT 1) FROM students WHERE student_age 10 ORDER BY RAND() LIMIT 1 I've looked and tried everything, but nothing seems

Re: Retrieve three columns in sub query

2010-08-25 Thread Tompkins Neil
: Tompkins Neil [mailto:neil.tompk...@googlemail.com] Sent: Wednesday, August 25, 2010 1:23 PM To: [MySQL] Subject: Retrieve three columns in sub query Hi Is it possible in MySQL 5.1 to retrieve three columns in a select sub-query like below : SELECT student_age, SELECT

Replication: ignore specified columns?

2010-07-23 Thread Bryan Cantwell
I know that you can ignore certain databases and tables in mysql replication, but is it possible to replicate all but a certain column or two from a table? This is 5.1.48 on linux. Thanks, Bryancan -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Re: Replication: ignore specified columns?

2010-07-23 Thread Claudio Nanni
No. If it is for security reasons: did you think about a view on slave db? (removing rights from source table) In case you dont want those columns to reach the slave you could use triggers to reflect changes from source table (or a view) on master to a table(with missing columns

Re: Ordering field names in a DESC / DESCRIBE table or SHOW COLUMNS from table command

2010-01-14 Thread Ricardo Dias Marques
Block mode and then selecting and deleting), I removed the columns that I didn't need (basically, removed every column EXCEPT the Field column). I also removed the extra lines that the mysqlshow command adds (decorative lines, column labels, etc...). Then, I saved this changed text file. 3

Ordering field names in a DESC / DESCRIBE table or SHOW COLUMNS from table command

2010-01-13 Thread Ricardo Dias Marques
and the SHOW COLUMNS (or its synonym SHOW FIELDS) command: MySQL :: MySQL 5.0 Reference Manual :: 12.3.1 DESCRIBE Syntax http://dev.mysql.com/doc/refman/5.0/en/describe.html MySQL :: MySQL 5.0 Reference Manual :: 12.5.5.5 SHOW COLUMNS Syntax http://dev.mysql.com/doc/refman/5.0/en/show-columns.html

Re: Ordering field names in a DESC / DESCRIBE table or SHOW COLUMNS from table command

2010-01-13 Thread Peter Brawley
in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ORDER BY Field' at line 1 So, I went to read the online documentation about the DESCRIBE command and the SHOW COLUMNS (or its synonym SHOW FIELDS) command: MySQL :: MySQL 5.0

Join between columns with unique keys randomly uses the keys, or uses a temporary table (which fails).

2009-12-11 Thread Matthew Blissett
Hi all I have this query: SELECT n.ID, n.CatalogNumber, [...more...], d.ID, d.CatalogNumber, [...more...] FROM newdarwincoredata n INNER JOIN darwincoredata d ON n.CatalogNumber = d.CatalogNumber ORDER BY n.CatalogNumber; Both tables have exactly the same structure and indices: mysql SHOW

Re: Choose certain columns in mysqldump?

2009-11-03 Thread Brian Dunning
select into outfile was the ticket. Thanks! -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/mysql?unsub=arch...@jab.org

  1   2   3   4   5   6   7   8   9   >