Re: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re: Help in Subquerys...

Re: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re: Help in Subquerys...

am 14.12.2004 19:17:14 von Jan Theodore Galkowski

Please send or post schemas for the tables involved, thanks.
I can get back to you on it by end of day, Eastern Time, USA.

-jtg

On Tue, 14 Dec 2004 15:47:15 -0300, "Daniel Bronzeri Barbosa"
said:
> An aditional information,
> this query
>
> SELECT max(int_key)
> FROM tbl_hlt_phonecall_historicaldata
> GROUP by int_phonecall_key
>
> Returns 2 rows
>
> int_key
> 184
> 188
>
> tks
>
> Daniel
>
> ----- Original Message -----
> From: "Daniel Bronzeri Barbosa"
> To: "Jan Theodore Galkowski"
> Cc:
> Sent: Tuesday, December 14, 2004 3:40 PM
> Subject: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re: Help in Subquerys...
>
>
> Jan Theodore,
>
> This query don't running too
>
> SELECT *
> FROM tbl_hlt_phonecall_historicaldata
> WHERE int_key =
> (
> SELECT max(int_key)
> FROM tbl_hlt_phonecall_historicaldata
> GROUP by int_phonecall_key
> )
>
> tks,
>
> Daniel
>
> ----- Original Message -----
> From: "Jan Theodore Galkowski"
> To: "Daniel Bronzeri Barbosa"
> Sent: Tuesday, December 14, 2004 2:25 PM
> Subject: [BRMA-ALTO-RISCO] Re: Help in Subquerys...
>
>
> Well, Daniel, for one thing the SQL syntax isn't right. Try:
>
> ... WHERE int_key = (select max(int_key) from ...
>
> -jtg
>
> On Tue, 14 Dec 2004 15:24:55 -0300, "Daniel Bronzeri Barbosa"
> said:
> > People,
> >
> > How can I run this query in MySQL 4.0???
> >
> > SELECT *
> > FROM `tbl_hlt_phonecall_historicaldata`
> > WHERE int_key in
> > (
> > select max(int_key)
> > from tbl_hlt_phonecall_historicaldata
> > group by int_phonecall_key
> > )

[snip]


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

Help in Subquerys...

am 14.12.2004 19:24:55 von Daniel Bronzeri Barbosa

------=_NextPart_000_0046_01C4E1F1.10B2FCB0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

People,

How can I run this query in MySQL 4.0???

SELECT *=20
FROM `tbl_hlt_phonecall_historicaldata`=20
WHERE int_key in=20
(
select max(int_key)
from tbl_hlt_phonecall_historicaldata
group by int_phonecall_key
)

Tanks for your help.

Daniel
------=_NextPart_000_0046_01C4E1F1.10B2FCB0--

Re: [BRMA-ALTO-RISCO] Re: Help in Subquerys...

am 14.12.2004 19:40:56 von Daniel Bronzeri Barbosa

Jan Theodore,

This query don't running too

SELECT *
FROM tbl_hlt_phonecall_historicaldata
WHERE int_key =
(
SELECT max(int_key)
FROM tbl_hlt_phonecall_historicaldata
GROUP by int_phonecall_key
)

tks,

Daniel

----- Original Message -----
From: "Jan Theodore Galkowski"
To: "Daniel Bronzeri Barbosa"
Sent: Tuesday, December 14, 2004 2:25 PM
Subject: [BRMA-ALTO-RISCO] Re: Help in Subquerys...


Well, Daniel, for one thing the SQL syntax isn't right. Try:

... WHERE int_key = (select max(int_key) from ...

-jtg

On Tue, 14 Dec 2004 15:24:55 -0300, "Daniel Bronzeri Barbosa"
said:
> People,
>
> How can I run this query in MySQL 4.0???
>
> SELECT *
> FROM `tbl_hlt_phonecall_historicaldata`
> WHERE int_key in
> (
> select max(int_key)
> from tbl_hlt_phonecall_historicaldata
> group by int_phonecall_key
> )

[snip]

--
Jan Theodore Galkowski (o°)
jtgalkowski@alum.mit.edu
http://www.smalltalkidiom.net



--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

Re: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re: Help in Subquerys...

am 14.12.2004 19:47:15 von Daniel Bronzeri Barbosa

An aditional information,
this query

SELECT max(int_key)
FROM tbl_hlt_phonecall_historicaldata
GROUP by int_phonecall_key

Returns 2 rows

int_key
184
188

tks

Daniel

----- Original Message -----
From: "Daniel Bronzeri Barbosa"
To: "Jan Theodore Galkowski"
Cc:
Sent: Tuesday, December 14, 2004 3:40 PM
Subject: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re: Help in Subquerys...


Jan Theodore,

This query don't running too

SELECT *
FROM tbl_hlt_phonecall_historicaldata
WHERE int_key =
(
SELECT max(int_key)
FROM tbl_hlt_phonecall_historicaldata
GROUP by int_phonecall_key
)

tks,

Daniel

----- Original Message -----
From: "Jan Theodore Galkowski"
To: "Daniel Bronzeri Barbosa"
Sent: Tuesday, December 14, 2004 2:25 PM
Subject: [BRMA-ALTO-RISCO] Re: Help in Subquerys...


Well, Daniel, for one thing the SQL syntax isn't right. Try:

... WHERE int_key = (select max(int_key) from ...

-jtg

On Tue, 14 Dec 2004 15:24:55 -0300, "Daniel Bronzeri Barbosa"
said:
> People,
>
> How can I run this query in MySQL 4.0???
>
> SELECT *
> FROM `tbl_hlt_phonecall_historicaldata`
> WHERE int_key in
> (
> select max(int_key)
> from tbl_hlt_phonecall_historicaldata
> group by int_phonecall_key
> )

[snip]

--
Jan Theodore Galkowski (o°)
jtgalkowski@alum.mit.edu
http://www.smalltalkidiom.net



--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=daniel@arccorp.com.br


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

Re: Help in Subquerys...

am 14.12.2004 20:14:28 von Troy Whistman

------=_NextPart_000_007F_01C4E1DE.D75CF7C0
Content-Type: multipart/alternative;
boundary="----=_NextPart_001_0080_01C4E1DE.D75CF7C0"


------=_NextPart_001_0080_01C4E1DE.D75CF7C0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

In MySQL 4.0, subqueries are not allowed. You need to pull the data you =
need into a secondary table, then do a join:

CREATE TEMPORARY TABLE temp_phone_calls
SELECT max(int_key) int_key FROM tbl_hlt_phonecall_historicaldata
GROUP BY int_phoneCall_key;

SELECT *
FROM tbl_hlt_phonecall_historicaldata
RIGHT JOIN temp_phone_calls
ON temp_phone_calls.int_key =3D =
tbl_hlt_phonecall_historicaldata.int_key;

DROP TEMPORARY TABLE temp_phone_calls;

Hope that helps! I ran this against the schema and data you posted, and =
the query returned the correct values (attached).

Troy Whistman
----- Original Message -----=20

>
> On Tue, 14 Dec 2004 15:24:55 -0300, "Daniel Bronzeri Barbosa"
> said:
> > People,
> >
> > How can I run this query in MySQL 4.0???
> >
> > SELECT *
> > FROM `tbl_hlt_phonecall_historicaldata`
> > WHERE int_key in
> > (
> > select max(int_key)
> > from tbl_hlt_phonecall_historicaldata
> > group by int_phonecall_key
> > )


------=_NextPart_001_0080_01C4E1DE.D75CF7C0
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable



charset=3Diso-8859-1">




In MySQL 4.0, subqueries are not =
allowed.  You=20
need to pull the data you need into a secondary table, then do a=20
join:

 

CREATE TEMPORARY TABLE =
temp_phone_calls
 =20
SELECT max(int_key) int_key FROM =
tbl_hlt_phonecall_historicaldata
 =20
GROUP BY int_phoneCall_key;

 

SELECT *
FROM=20
tbl_hlt_phonecall_historicaldata
RIGHT JOIN =
temp_phone_calls
  ON=20
temp_phone_calls.int_key =
tbl_hlt_phonecall_historicaldata.int_key;

 

DROP TEMPORARY TABLE =
temp_phone_calls;

 

Hope that helps!  I ran this =
against the=20
schema and data you posted, and the query returned the correct values=20
(attached).

 

Troy Whistman

style=3D"PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; =
BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
----- Original Message -----=20

>
> On Tue, 14 Dec 2004 15:24:55 -0300, "Daniel =
Bronzeri=20
Barbosa"
> < href=3D"mailto:daniel@arccorp.com.br">daniel@arccorp.com.br>=20
said:
> > People,
> >
> > How can I run =
this query=20
in MySQL 4.0???
> >
> > SELECT *
> > FROM=20
`tbl_hlt_phonecall_historicaldata`
> > WHERE int_key =
in
> >=20
(
> > select max(int_key)
> > from=20
tbl_hlt_phonecall_historicaldata
> > group by=20
int_phonecall_key
> > )



------=_NextPart_001_0080_01C4E1DE.D75CF7C0--


------=_NextPart_000_007F_01C4E1DE.D75CF7C0
Content-Type: text/plain; charset=us-ascii

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
------=_NextPart_000_007F_01C4E1DE.D75CF7C0--

Re: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re: Help in Subquerys...

am 14.12.2004 20:31:16 von Daniel Bronzeri Barbosa

------=_NextPart_000_0088_01C4E1FA.5540A4F0
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

Jan Theodore,

The schemas and data-sample are attached.

I need view the last int_key row grouped by int_phonecall_key.

Tks

Daniel



----- Original Message -----
From: "Jan Theodore Galkowski"
To: "Daniel Bronzeri Barbosa" ; "Daniel Bronzeri
Barbosa"
Cc:
Sent: Tuesday, December 14, 2004 3:17 PM
Subject: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re:
Help in Subquerys...


Please send or post schemas for the tables involved, thanks.
I can get back to you on it by end of day, Eastern Time, USA.

-jtg

On Tue, 14 Dec 2004 15:47:15 -0300, "Daniel Bronzeri Barbosa"
said:
> An aditional information,
> this query
>
> SELECT max(int_key)
> FROM tbl_hlt_phonecall_historicaldata
> GROUP by int_phonecall_key
>
> Returns 2 rows
>
> int_key
> 184
> 188
>
> tks
>
> Daniel
>
> ----- Original Message -----
> From: "Daniel Bronzeri Barbosa"
> To: "Jan Theodore Galkowski"
> Cc:
> Sent: Tuesday, December 14, 2004 3:40 PM
> Subject: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re: Help in Subquerys...
>
>
> Jan Theodore,
>
> This query don't running too
>
> SELECT *
> FROM tbl_hlt_phonecall_historicaldata
> WHERE int_key =
> (
> SELECT max(int_key)
> FROM tbl_hlt_phonecall_historicaldata
> GROUP by int_phonecall_key
> )
>
> tks,
>
> Daniel
>
> ----- Original Message -----
> From: "Jan Theodore Galkowski"
> To: "Daniel Bronzeri Barbosa"
> Sent: Tuesday, December 14, 2004 2:25 PM
> Subject: [BRMA-ALTO-RISCO] Re: Help in Subquerys...
>
>
> Well, Daniel, for one thing the SQL syntax isn't right. Try:
>
> ... WHERE int_key = (select max(int_key) from ...
>
> -jtg
>
> On Tue, 14 Dec 2004 15:24:55 -0300, "Daniel Bronzeri Barbosa"
> said:
> > People,
> >
> > How can I run this query in MySQL 4.0???
> >
> > SELECT *
> > FROM `tbl_hlt_phonecall_historicaldata`
> > WHERE int_key in
> > (
> > select max(int_key)
> > from tbl_hlt_phonecall_historicaldata
> > group by int_phonecall_key
> > )

[snip]


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=daniel@arccorp.com.br


------=_NextPart_000_0088_01C4E1FA.5540A4F0
Content-Type: text/plain; charset=us-ascii

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
------=_NextPart_000_0088_01C4E1FA.5540A4F0--

Re: [BRMA-ALTO-RISCO] Re: Help in Subquerys...

am 15.12.2004 05:57:23 von Jan Theodore Galkowski

Daniel,

Here you go:
=20
SELECT A .*=20
FROM tbl_hlt_phonecall_historicaldata A
WHERE A.int_key =3D (
SELECT max( B.int_key )=20
FROM tbl_hlt_phonecall_historicaldata B
WHERE A.int_phonecall_key =3D B.int_phonecall_key
)


It is not strictly true subqueries are not allowed in your MySQL. The
above ran successfully in MySQL 4.1. I don't see any change in this
area
called out in its release documentation from 4.0. I believe the=20
problem in your original was the GROUP BY. The correlated subquery=20
works fine.=20

Sorry for the delay in reply.

- Jan


On Tue, 14 Dec 2004 16:31:16 -0300, "Daniel Bronzeri Barbosa"
said:
> Jan Theodore,
>=20
> The schemas and data-sample are attached.
>=20
> I need view the last int_key row grouped by int_phonecall_key.
>=20
> Tks
>=20
> Daniel
>=20
>=20
>=20
> ----- Original Message -----=20
> From: "Jan Theodore Galkowski"
> To: "Daniel Bronzeri Barbosa" ; "Daniel Bronzeri
> Barbosa"
> Cc:
> Sent: Tuesday, December 14, 2004 3:17 PM
> Subject: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO]
> Re:
> Help in Subquerys...
>=20
>=20
> Please send or post schemas for the tables involved, thanks.
> I can get back to you on it by end of day, Eastern Time, USA.
>=20
> -jtg
>=20
> On Tue, 14 Dec 2004 15:47:15 -0300, "Daniel Bronzeri Barbosa"
> said:
> > An aditional information,
> > this query
> >
> > SELECT max(int_key)
> > FROM tbl_hlt_phonecall_historicaldata
> > GROUP by int_phonecall_key
> >
> > Returns 2 rows
> >
> > int_key
> > 184
> > 188
> >
> > tks
> >
> > Daniel
> >
> > ----- Original Message -----=20
> > From: "Daniel Bronzeri Barbosa"
> > To: "Jan Theodore Galkowski"
> > Cc:
> > Sent: Tuesday, December 14, 2004 3:40 PM
> > Subject: [BRMA-ALTO-RISCO] Re: [BRMA-ALTO-RISCO] Re: Help in Subquerys.=
...
> >
> >
> > Jan Theodore,
> >
> > This query don't running too
> >
> > SELECT *
> > FROM tbl_hlt_phonecall_historicaldata
> > WHERE int_key =3D
> > (
> > SELECT max(int_key)
> > FROM tbl_hlt_phonecall_historicaldata
> > GROUP by int_phonecall_key
> > )
> >
> > tks,
> >
> > Daniel
> >
> > ----- Original Message -----=20
> > From: "Jan Theodore Galkowski"
> > To: "Daniel Bronzeri Barbosa"
> > Sent: Tuesday, December 14, 2004 2:25 PM
> > Subject: [BRMA-ALTO-RISCO] Re: Help in Subquerys...
> >
> >
> > Well, Daniel, for one thing the SQL syntax isn't right. Try:
> >
> > ... WHERE int_key =3D (select max(int_key) from ...
> >
> > -jtg
> >
> > On Tue, 14 Dec 2004 15:24:55 -0300, "Daniel Bronzeri Barbosa"
> > said:
> > > People,
> > >
> > > How can I run this query in MySQL 4.0???
> > >
> > > SELECT *
> > > FROM `tbl_hlt_phonecall_historicaldata`
> > > WHERE int_key in
> > > (
> > > select max(int_key)
> > > from tbl_hlt_phonecall_historicaldata
> > > group by int_phonecall_key
> > > )

[snip]

--=20
Jan Theodore Galkowski (o°) =

jtgalkowski@alum.mit.edu
http://www.smalltalkidiom.net



--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org

Convert string to Double

am 15.12.2004 17:38:26 von Daniel Bronzeri Barbosa

Hi Everybody,

Somebody knows how i can convert String to Double in MySQL 4.0?

Tks

Daniel

--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org

Re: Convert string to Double

am 15.12.2004 21:31:15 von Randy Clamons

Daniel,

That depends on what you want to do. If you have a column defined as char o=
r varchar and the stored value is numeric, the conversion should be 'automa=
gic'. MySql will treat the numeric part of the char value as numeric value =
until it reaches a non-numeric value. Ex:

"123.45" =3D 123.45
"123.a45" =3D 123
"1a23.45" =3D 11
"a123.45" =3D 0

Lookup CAST or CONVERT in the documentation for information about data conv=
ersion.



> ------------Original Message------------
> From: "Daniel Bronzeri Barbosa"
> To: win32@lists.mysql.com
> Date: Wed, Dec-15-2004 8:33 AM
> Subject: Convert string to Double
>
> Hi Everybody,
> =

> Somebody knows how i can convert String to Double in MySQL 4.0?
> =

> Tks
> =

> Daniel


--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=3Dgcdmw-win32@m.gmane.org