473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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(substring(md5(email),9,16),16,10))) as b from
email_table_copy group by id/1024 order by 1 limit 5;

I get a rsultset -

id/1024 b
------- -------------------------------
0.00 909388403840711996371492430000
0.01 2205732187095504887683337060000
0.02 1674463121499308443382963454000
0.03 1770590858478526561626311655000
0.04 3376981218189278277222690357000

When I execute a query like -

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

I get a resultset -

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

------- --------------------------------
--------------------------------
0.00 a0cb77a048bcafa0c122a97c48c4dc2f
1322364373425669539519654994000
0.01 3d3de1a6987b54fa31c9290a0eaa987d
11944879734104128479516410860000
0.02 0b84e00a70f4d0b2cfc38449e5ab8b4b
276678297684241708186218316000
0.03 025ab61135c8ed4a329dd5670801e866
54875101143019835333537694000
0.04 f53e627643b62f9bda102b0612f28ec3
4118456286152667004309559280000

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 1207

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

Similar topics

0
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...
0
by: Karam Chand | last post by:
Greetings I have a table with the following table structure - Field Type Collation Null Key Default Extra ------- ------------- ----------------- ------ ------ ...
2
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...
7
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...
4
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...
12
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: ...
0
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;...
1
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...
13
by: ajos | last post by:
hi frnds, im doing some db related operations in my web project,im using mysql 5.0,i have the following piece of code in my action class- for(resultset =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...

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.