MySQL

 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Tutorialized ForumsDatabasesMySQL

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Tutorialized Forums Sponsor:
  #1  
Old January 20th, 2014, 05:18 AM
Pia_SQL Pia_SQL is offline
Registered User
Tutorialized Newbie (0 - 499 posts)
 
Join Date: Jan 2014
Posts: 2 Pia_SQL User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 22 m 28 sec
Reputation Power: 0
SQL Query MAX(ID)

Hi,

Im almost e beginner in SQL and have aproblem with a query.
I have data in a table looks like this:

Country Code, OrderNo, ID, Price
FR 0001 0 6.00
FR 0002 0 1.00
FR 0003 0 5.00
FR 0001 1 10.00

Now, Im trying to query data that looks:
I want to have for each OrderNo the record with the highest ID
Country, OrderNo, ID, Price
FR 0002 0 1.00
FR 0003 0 5.00
FR 0001 1 10.00

I dont know how to query the data
SELECT CountryCode, OrderNo, MAX(RatioID) AS RatioID, SRin
FROM prices_per_country
GROUP BY OrderNO
Gives an wrong result (OrderNO 001 --> should give a price of 10.00)
FR 0001 1 6.00
FR 0002 0 1.00
FR 0003 0 5.00

thanks in advance for help!!!

Reply With Quote
Reply

Viewing: Tutorialized ForumsDatabasesMySQL > SQL Query MAX(ID)


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 

Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap