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 dateOfBirt
If your dateOfBirth is a date field, you can do this:
select
(substring(curdate(),1,4)-substring(dateofbirth,1,4))-(substr(curdate(),5) escreveu na mensagem
news:[EMAIL PROTECTED]
> 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'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
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
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
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
diff
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 o
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: 86
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, Neil
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 entrie
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
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 List
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]
Sub
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
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"
> > 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 t
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 (high
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 Live
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 can
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.c
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:http://lists.mysq
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 PROTECT
22 matches
Mail list logo