473,585 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Anomaly in resultset

Greetings

I have a table with the following table structure -

Field Type Collation Null Key
Default Extra
------- ------------- ----------------- ------
------ ------- ------
email char(75) latin1_swedish_ ci

is_sent enum('Y','N') latin1_swedish_ ci YES
N
id int(11) binary PRI
0

I store information about people email whom i need to
send mails and whether a mail has been sent to them or
not.

When I execute a query something like this -

select id/1024,
concat(sum(conv (substring(md5( email),1,8),16, 10)),
sum(conv(substr ing(md5(email), 9,16),16,10))) as b from
email_table_cop y group by id/1024 order by 1 limit 5;

I get a rsultset -

id/1024 b
------- -------------------------------
0.00 909388403840711 996371492430000
0.01 220573218709550 488768333706000 0
0.02 167446312149930 844338296345400 0
0.03 177059085847852 656162631165500 0
0.04 337698121818927 827722269035700 0

When I execute a query like -

select id/1024, @a:=md5(email),
concat(sum(conv (substring(@a,1 ,8),16,10)),
sum(conv(substr ing(@a,9,16),16 ,10))) as b from
email_table_cop y group by id/1024 order by 1 limit 5;

I get a resultset -

id/1024 @a:=md5(email) b

------- --------------------------------
--------------------------------
0.00 a0cb77a048bcafa 0c122a97c48c4dc 2f
132236437342566 953951965499400 0
0.01 3d3de1a6987b54f a31c9290a0eaa98 7d
119448797341041 284795164108600 00
0.02 0b84e00a70f4d0b 2cfc38449e5ab8b 4b
276678297684241 708186218316000
0.03 025ab61135c8ed4 a329dd5670801e8 66
548751011430198 35333537694000
0.04 f53e627643b62f9 bda102b0612f28e c3
411845628615266 700430955928000 0

Shouldnt be the value of `b` be same both the times.
By executing the second query i belive i do md5
conversion only once which should significantly boost
the result on a big table.

Am I doing something wrong?

Also, what is the best way to remove the md5 key
column from the resultset as I dont need that.

Thanks in advance

Karam

_______________ _______________ ____
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
0 1297

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3638
by: RoyalScorpion | last post by:
hi guys, i get an updatable resultset from a connection then used it to insert a new row but the result set doesn't chane after insertion, i mean the no of rows before insertion is the same after insertion and also the data, this is the code prove what i say int currentRow = resultset.getRow(); display(resultset);...
0
1082
by: Karam Chand | last post by:
Greetings I have a table with the following table structure - Field Type Collation Null Key Default Extra ------- ------------- ----------------- ------ ------ ------- ------ email char(75) latin1_swedish_ci
0
1222
by: Karam Chand | last post by:
Greetings I have a table with the following table structure - Field Type Collation Null Key Default Extra ------- ------------- ----------------- ------ ------ ------- ------ email char(75) latin1_swedish_ci
2
1780
by: Savas Ates | last post by:
I have a stored procedure below.. When I run it with a well parameter in query analyser 3 of select statements return me. (i named select statements 1,2,3) But in asp page when i call this procedure same as query analyser it returns me 2 select statements value? what is the problem ? CREATE PROCEDURE ST_25INDIRIM @sesid BIGINT AS
7
12802
by: Gandalf | last post by:
Hi all, I am connecting to DB2 8.1 on Solaris through JDBC type 4 drivers (driver: com.ibm.db2.jcc.DB2Driver). Problem is that when a cursored query is done, the resultset gets closed after commit (resultset.next() throws SqlException "Invalid operation: result set closed"). Is there a way to tell DB2 not to close the resultset/cursor?
4
4439
by: _link98 | last post by:
Problem: java ResultSet cursor from SQL/PL stored-procedure is FORWARD_ONLY. Is it possible to have ResultSet cursors from SQL/PL procedures to scroll forward and backwards? Perhaps I am missing something. Environment: client UDB 8.1 FP9a on Win32, server UDB 8.1 FP9a on Solaris 8 (64BIT). The JDK version on the WinXP client is
12
2172
by: robertino | last post by:
Hi all, I've put together a few SPs to produce a BOM (bill of materials) listing, which together use a couple of global temp tables, and return the results from a cursor. Here's the code: -- Initialize the temp tables............ create procedure myschema.init_ebom_tables ( ) language sql
0
6157
by: David Linsin | last post by:
I created a simple test case to reproduce the problem (also check Bug #15500): import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.Statement; /** * Simple test program to reproduce bug
1
2789
by: mai | last post by:
Hi everyone, i'm trying to exhibit FIFO anomaly(page replacement algorithm),, I searched over 2000 random strings but i couldnt find any anomaly,, am i I doing it right?,, Please help,,,The following is the code,, #include <iostream> #include <string> #include <stdio.h> #include <stdlib.h> #include <ctime // For time()
0
7908
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8336
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6606
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3835
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2343
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.