From DATE_FORMAT and back to origin date in mysql date column

2013-07-24 Thread Karl-Arne Gjersøyen
SELECT DATE_FORMAT(dato, '%e/%c/%Y') AS dato FROM transportdokument WHERE
dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC is working
perfect in my PHP file.

But I need to transfer the date back from my norwegian formatted date to
the origin date format in WHERE dato = '$standard_date_format';

What need I do to fix this?

Thanks for your time and help to learn me programming!

Karl


Replication question

2013-07-24 Thread rich gray
I have been asked to set up multiple database replication which I have 
done before for simple cases however there are some nuances with this 
instance that add some complexity and I'd like to hear your collective 
expertise on this proposed scenario:-


1) Single master database
2) n (probably 3 to start with) number of slave databases
3) All but 5 tables (123 tables in total) are to be replicated from the 
master to all the slaves

4) 3 tables from the slaves are to be replicated back to the master

It is mainly item 4) that concerns me - the primary ID's are almost 
certain to collide unless I seed the auto increment ID to partition the 
IDs into separate ranges or does MySQL handle this issue?
There are some foreign keys on one of the 3 slave to master tables but 
they are pointing at some extremely static tables that are very unlikely 
to change.


Is the above a feasible implementation...?

Thanks in advance for any advice/pointers!

Rich



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



RE: From DATE_FORMAT and back to origin date in mysql date column

2013-07-24 Thread Rick James
I'm unclear on your task, but maybe this function will help:
http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date

(It is confusing to have dato as both a column name and an alias.)

 -Original Message-
 From: Karl-Arne Gjersøyen [mailto:karlar...@gmail.com]
 Sent: Wednesday, July 24, 2013 7:02 AM
 To: MySQL Mailinglist
 Subject: From DATE_FORMAT and back to origin date in mysql date column
 
 SELECT DATE_FORMAT(dato, '%e/%c/%Y') AS dato FROM transportdokument WHERE
 dato = '2013-07-20' AND dato = '2013-07-24' GROUP BY dato DESC is
 working perfect in my PHP file.
 
 But I need to transfer the date back from my norwegian formatted date to
 the origin date format in WHERE dato = '$standard_date_format';
 
 What need I do to fix this?
 
 Thanks for your time and help to learn me programming!
 
 Karl

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



RE: Replication question

2013-07-24 Thread Rick James
 4) 3 tables from the slaves are to be replicated back to the master
NO.

However, consider Percona XtraDb Cluster or MariaDB+Galera.  They allow 
multiple writable masters.  But they won't let you be so selective about tables 
not being replicated.
Here are the gotchas for Galera usage:
http://mysql.rjweb.org/doc.php/galera
If you can live with them (plus replicating everything), it may be best for you.

 -Original Message-
 From: rich gray [mailto:r...@richgray.com]
 Sent: Wednesday, July 24, 2013 8:21 AM
 To: mysql@lists.mysql.com
 Subject: Replication question
 
 I have been asked to set up multiple database replication which I have
 done before for simple cases however there are some nuances with this
 instance that add some complexity and I'd like to hear your collective
 expertise on this proposed scenario:-
 
 1) Single master database
 2) n (probably 3 to start with) number of slave databases
 3) All but 5 tables (123 tables in total) are to be replicated from the
 master to all the slaves
 4) 3 tables from the slaves are to be replicated back to the master
 
 It is mainly item 4) that concerns me - the primary ID's are almost
 certain to collide unless I seed the auto increment ID to partition the
 IDs into separate ranges or does MySQL handle this issue?
 There are some foreign keys on one of the 3 slave to master tables but
 they are pointing at some extremely static tables that are very unlikely
 to change.
 
 Is the above a feasible implementation...?
 
 Thanks in advance for any advice/pointers!
 
 Rich
 
 
 
 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/mysql


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql