Mysql HA

2006-09-15 Thread JM
Hi, Is it possible to implement an HA configuration in mysql without using Mysql Clustering? A howto is very much appreciated.. thanks, Mailing-List -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL

How to sort last n entries?

2006-09-15 Thread Dominik Klein
I have a table with primary key id. Another field is date. Now I want the last n entries, sorted by date. Is this possible in one SQL statement? Thanks for your help Dominik -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:

Re: How to sort last n entries?

2006-09-15 Thread Chris Sansom
At 10:41 +0200 15/9/06, Dominik Klein wrote: I have a table with primary key id. Another field is date. Now I want the last n entries, sorted by date. Is this possible in one SQL statement? ORDER BY `date` DESC LIMIT n -- Cheers... Chris Highway 57 Web Development -- http://highway57.co.uk/

Re: Mysql HA

2006-09-15 Thread Anders Karlsson
Sure. MySQL runs just fine in an Active /Passive configuration for HA. There is a white paper that you can request from the MySQL homepage among the other white papers here: http://www.mysql.com/why-mysql/white-papers/ For such a configuration, a popular choice is to use Linux HA. You

Show differences between two tables

2006-09-15 Thread Neil Tompkins
Hi I've two tables TableA FieldID Enabled TableB FieldID Enabled What query would I need to show what FieldIDs which are the same, but the enabled field status is different ?Thanks, Neil _ Be one of the first to try Windows

Re: How to sort last n entries?

2006-09-15 Thread Dominik Klein
Chris Sansom schrieb: At 10:41 +0200 15/9/06, Dominik Klein wrote: I have a table with primary key id. Another field is date. Now I want the last n entries, sorted by date. Is this possible in one SQL statement? ORDER BY `date` DESC LIMIT n Last n entries means I want the last (highest)

Re: How to sort last n entries?

2006-09-15 Thread Martijn Tonies
At 10:41 +0200 15/9/06, Dominik Klein wrote: I have a table with primary key id. Another field is date. Now I want the last n entries, sorted by date. Is this possible in one SQL statement? ORDER BY `date` DESC LIMIT n Last n entries means I want the last (highest) n ids.

RE: How to sort last n entries?

2006-09-15 Thread Peter Lauri
SELECT * FROM table WHERE id=(SELECT id FROM table ORDER BY id DESC) ORDER BY date -Original Message- From: Dominik Klein [mailto:[EMAIL PROTECTED] Sent: Friday, September 15, 2006 3:41 PM To: mysql@lists.mysql.com Subject: How to sort last n entries? I have a table with primary key id.

FW: How to sort last n entries?

2006-09-15 Thread Peter Lauri
Assuming your MySQL version supports sub queries you do like this. I have never done sub queries my self, but I know the theory :) SELECT * FROM table WHERE id = (SELECT id FROM table ORDER BY id DESC) ORDER BY date /Peter Lauri www.lauri.se - personal www.dwsasia.com - company (Web Development

RE: How to sort last n entries?

2006-09-15 Thread Peter Lauri
And if your MySQL version does NOT support sub queries you can probably just create a temporary table and then sort that one. /Peter -Original Message- From: Peter Lauri [mailto:[EMAIL PROTECTED] Sent: Friday, September 15, 2006 4:28 PM To: mysql@lists.mysql.com Cc: [EMAIL PROTECTED]

Re: How to sort last n entries?

2006-09-15 Thread Dominik Klein
Peter Lauri schrieb: SELECT * FROM table WHERE id=(SELECT id FROM table ORDER BY id DESC) ORDER BY date This does not limit it to n entries (order by date limit n is not sufficient as I need last (highest) n ids). And afaik, limit is not allowed in sub-queries. -- MySQL General Mailing

RE: How to sort last n entries?

2006-09-15 Thread Peter Lauri
You are correct. So that maybe leaves you with a temporary table then :) -Original Message- From: Dominik Klein [mailto:[EMAIL PROTECTED] Sent: Friday, September 15, 2006 4:45 PM To: mysql@lists.mysql.com Subject: Re: How to sort last n entries? Peter Lauri schrieb: SELECT * FROM table

RE: How to sort last n entries?

2006-09-15 Thread Peter Lauri
CREATE TEMPORARY TABLE tabletemp SELECT * FROM table ORDER BY id DESC LIMIT 30; SELECT * FROM tabletemp ORDER BY date; -Original Message- From: Dominik Klein [mailto:[EMAIL PROTECTED] Sent: Friday, September 15, 2006 4:45 PM To: mysql@lists.mysql.com Subject: Re: How to sort last n

Re: Show differences between two tables

2006-09-15 Thread Dan Buettner
Hi Neil - Something like this ought to work, joining on the ID column to find matches between tables, then finding the enabled fields which are not equal. SELECT a.fieldID, a.enabled, b.enabled FROM TableA a, TableB b WHERE a.fieldID = b.fieldID AND a.enabled != b.enabled Dan On 9/15/06,

RE: Show differences between two tables

2006-09-15 Thread Jerry Schwartz
This may be the blind leading the one-eyed, but wouldn't SELECT FieldID FROM TableA, TableB WHERE TableA.FieldID = TableB.FieldID AND TableA.Enabled != TableB.Enabled; Work? Regards, Jerry Schwartz Global Information Incorporated 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX:

Re: How to sort last n entries?

2006-09-15 Thread Brent Baisley
This might work, I've used this syntax to select and sort from a UNION. SELECT * FROM (SELECT * FROM table ORDER BY id DESC LIMIT n) AS ltable ORDER BY datefield DESC According to the documentation you can use limit in subqueries: A subquery can contain any of the keywords or clauses that an

Sort Problem

2006-09-15 Thread Albert Padley
I have the following query that has worked fine for displaying standings for a soccer league. SELECT * FROM standings WHERE division = 'BU10' AND pool = '1' ORDER BY tpts DESC, spts DESC, w DESC, ga ASC, team_number ASC As I said, works fine. Now, however, the league wants a slightly

Re: Sort Problem

2006-09-15 Thread Chris W
Albert Padley wrote: I have the following query that has worked fine for displaying standings for a soccer league. SELECT * FROM standings WHERE division = 'BU10' AND pool = '1' ORDER BY tpts DESC, spts DESC, w DESC, ga ASC, team_number ASC As I said, works fine. Now, however, the league

Re: Sort Problem

2006-09-15 Thread Albert Padley
On Sep 15, 2006, at 12:56 PM, Chris W wrote: Albert Padley wrote: I have the following query that has worked fine for displaying standings for a soccer league. SELECT * FROM standings WHERE division = 'BU10' AND pool = '1' ORDER BY tpts DESC, spts DESC, w DESC, ga ASC, team_number ASC

Query to get count of ages

2006-09-15 Thread cnelson
I'm working on MySQL v5.0 and I have a table with dateOfBirth and I want a histogram of ages at a point in time. I tried something like: select round(datediff(curdate(), dateofbirth)/365) as age, count(age) from myTable group by age; but MySQL Query Browser says: Unknown column 'age' in

Re: Query to get count of ages

2006-09-15 Thread Jo�o C�ndido de Souza Neto
If your dateOfBirth is a date field, you can do this: select (substring(curdate(),1,4)-substring(dateofbirth,1,4))-(substr(curdate(),5)substr(dateofbirth,5)) as age from myTable; But you can't get a group by from an alias. Hope help. [EMAIL PROTECTED] escreveu na mensagem news:[EMAIL

Re: Query to get count of ages

2006-09-15 Thread Alvaro Cobo
You could try something like this: SELECT DISTINCT(round(datediff(curdate(), dateofbirth)/365)) as age, COUNT(round(datediff(curdate(), dateofbirth)/365)) AS total_age from myTable group by age Not sure, but could work. Regards, Alvaro João Cândido de Souza Neto escribió: If your