Article View: es.comp.lenguajes.php
Article #2Re: Consulta MYSQL rango edad
From: Alvaro G. Vicario
Date: Wed, 22 Sep 2004 18:49
Date: Wed, 22 Sep 2004 18:49
34 lines
2435 bytes
2435 bytes
*** Ariel escribi�/wrote (22 Sep 2004 10:53:11 -0700): > hasta aqui funciona bien pero si agrego un WHERE para que me muestre > un rango de edaddes tengo problemas El manual de MySQL explica: Standard SQL doesn't allow you to refer to a column alias in a WHERE clause. This is because when the WHERE code is executed, the column value may not yet be determined. For example, the following query is illegal: SELECT id, COUNT(*) AS cnt FROM tbl_name WHERE cnt > 0 GROUP BY id; http://dev.mysql.com/doc/mysql/en/Problems_with_alias.html Vamos, que no se puede. Sin embargo no creo que sea necesario montar todo este barullo. Si necesitas mostrar registros cuya edad est� entre 22 y 24 simplemente haz un BETWEEN restando a la fecha actual 22 y 24 a�os. Supongo que hay que hacer alg�n peque�o ajuste pero b�sicamente �sa es la idea. (Creo que no es necesario mandar el mensaje a cuatro grupos, el tiempo de los dem�s tambi�n tiene valor) -- -+ �lvaro G. Vicario - Burgos, Spain +- http://www.demogracia.com (la web de humor barnizada para la intemperie) ++ Las dudas inform�ticas recibidas por correo ir�n directas a la papelera -+ I'm not a free help desk, please don't e-mail me your questions --
Technical Details
Message-ID:
<zwl4zmp2s5h0$.1k0y11ckqt4de.dlg@40tude.net>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mailReferences:
<e818990a.0409220953.3e9be61@posting.google.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 107579,f65c25bebf08bd32
X-Google-Thread: 105378,f65c25bebf08bd32
X-Google-Thread: 107d6b,f65c25bebf08bd32
X-Google-Thread: f86c8,f65c25bebf08bd32
X-Google-Attributes: gid107579,gid105378,gid107d6b,gidf86c8,public
X-Google-Language: SPANISH,ASCII
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!fu-berlin.de!uni-berlin.de!not-for-mail
From: "Alvaro G. Vicario" <kAlvaroNOSPAMTHANKS@terra.es>
Newsgroups: es.comp.lenguajes.php,es.comp.lenguajes.misc,chile.comp.misc,es.comp.os.linux.programacion
Subject: Re: Consulta MYSQL rango edad
Date: Wed, 22 Sep 2004 20:49:53 +0200
Organization: http://www.demogracia.com/
Lines: 34
Message-ID: <zwl4zmp2s5h0$.1k0y11ckqt4de.dlg@40tude.net>
References: <e818990a.0409220953.3e9be61@posting.google.com>
Mime-Version: 1.0
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de BJVEd4LK/HTX5fXxhWcMnwTt9beM/+ShJd+f9GckcIZgEdcKdi
User-Agent: 40tude_Dialog/2.0.13.1
X-Face: .A#7!%uYRN~"+p-LAwLQkX3X;`4J7r(3vkI;^8oo&8^@94hpypc,&_1?;=xp,)R40{X#E8& )"p01g~piJbPiLJxlO0oEC;rUw2b6|$^d}T2G4W$CCf"4PG&(^kK367qD/!lqc^3nvM7D~l5CW\`gt Nl(cq/`Ld01>cP[1nvyI>