473,403 Members | 2,222 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,403 software developers and data experts.

MySQL to MSSQL Conversion

113 100+
Hi,

I wouldn't post such a lazy question usually but I've got to have this sorted for the end of the day, sorry! Could someone tell me how to write this statement in MSSQL please?

[code]
SELECT scores.id, scores.name, scores.email, scores.time, scores.milliseconds
FROM scores
INNER JOIN
(
SELECT T2.id, T2.name, T2.email, min(time_to_sec(T2.time)*1000+T2.milliseconds) AS mintime
FROM scores T2 GROUP BY T2.name, T2.email
) T3 ON scores.name = T3.name AND scores.email = T3.email
AND (time_to_sec(scores.time)*1000+scores.milliseconds ) = T3.mintime
ORDER BY T3.mintime LIMIT 10
{/code]

What the query should return is a recordset of unique names and their highest score based on the time and milliseconds columns in the db.

Thanks!

Chromis
Aug 21 '08 #1
1 1723
chromis
113 100+
Ok it just needed a bit of adjustment:
Expand|Select|Wrap|Line Numbers
  1. SELECT   SCORES.ID,
  2.          SCORES.NAME,
  3.          SCORES.EMAIL,
  4.          SCORES.USERTIME
  5. FROM     SCORES
  6.          INNER JOIN (SELECT   T2.NAME,
  7.                               T2.EMAIL,
  8.                               MIN(USERTIME)  AS MINTIME
  9.                      FROM     SCORES T2
  10.                      GROUP BY T2.NAME,T2.EMAIL) T3
  11.            ON SCORES.NAME = T3.NAME
  12.               AND SCORES.EMAIL = T3.EMAIL
  13.               AND SCORES.USERTIME = T3.MINTIME
  14. ORDER BY T3.MINTIME
  15.  
Also for anyone interested theres a nice SQL formatter here
Aug 22 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

133
by: jonathan | last post by:
hey all, I realize that this question might pop up from time to time, but I haven't seen it a while and things might of changed, so - Right now (July 2004) how does mysql stand up in...
2
by: James Alexander Starritt | last post by:
I also posted similarly in mailing.database.mysql I have created a rather large (60 table database) website dealio in PHP that works with MS SQL Server, Oracle, MySQL and presumably any other...
11
by: ralphie | last post by:
hi all since nearly 2 days i fight with mssql and utf-8 as i need to store and retrieve arabic characters. i tried the com approach ...
0
by: CherryJames | last post by:
Hi Friends, Is there any alternative to 'stored procedures' in MySQL for versions other than MySQL 5.0 ? Or, is there any conversion trick used to change stored procedures in MSSQL to 'something...
7
clintw
by: clintw | last post by:
I'm trying to convert a MSSQL select statement to MySQL, but am having difficulty with the following section: ... INNER JOIN tableA ON tableB.field1 = tableA.field1 INNER JOIN tableC ON...
5
by: M. Savas Zorlu | last post by:
Hi, I just decided to leave Mssql and start using Mysql. I am having some problems with my queries; is there anyone here who has a knowledge of query syntax in Mysql? If so, I need some help...
0
by: exclaim | last post by:
Apologies if this is not the right forum. I have an application written originally to work with MySQL which now has to be extended to work with MSSQL also. I have modified all my database calls...
0
by: Gosth in the shell | last post by:
Hi there, i need some help I got a software to backend is MSSQL 2005, but a provider software requires an UPDATE on his table with MySQL 5.0.56a backend, so i made the next: download and...
0
by: johnyjj2 | last post by:
Hello! I've got web application written in MSSQL and I need to run it on server. But on the server I've go MySQL (not MSSQL), PHP, KFWS. Do I have to install MSSQL and have both MySQL and MSSQL?...
1
ssnaik84
by: ssnaik84 | last post by:
Hi Guys, Last year I got a chance to work with R&D team, which was working on DB scripts conversion.. Though there is migration tool available, it converts only tables and constraints.. Rest of...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.