Click here to Skip to main content
15,916,462 members
Home / Discussions / Database
   

Database

 
AnswerRe: Just installed SQL Server 2008 R2 - Where is the app to create/open/add/update/delete DB file? Pin
phil.o28-Oct-11 2:25
professionalphil.o28-Oct-11 2:25 
QuestionNeed help with update SQL with subquery Pin
Hypermommy26-Oct-11 3:14
Hypermommy26-Oct-11 3:14 
AnswerRe: Need help with update SQL with subquery Pin
Corporal Agarn26-Oct-11 3:46
professionalCorporal Agarn26-Oct-11 3:46 
AnswerRe: Need help with update SQL with subquery Pin
Hypermommy26-Oct-11 6:03
Hypermommy26-Oct-11 6:03 
QuestionSELECT ... GROUP BY Error Pin
MikeDhaan26-Oct-11 1:07
MikeDhaan26-Oct-11 1:07 
AnswerRe: SELECT ... GROUP BY Error Pin
Simon_Whale26-Oct-11 1:13
Simon_Whale26-Oct-11 1:13 
GeneralRe: SELECT ... GROUP BY Error Pin
MikeDhaan26-Oct-11 1:59
MikeDhaan26-Oct-11 1:59 
GeneralRe: SELECT ... GROUP BY Error Pin
Jörgen Andersson26-Oct-11 2:37
professionalJörgen Andersson26-Oct-11 2:37 
Then you need to remove the Value column from the query.
SQL
SELECT MAX(TheDate), Type
FROM   MyTable
GROUP BY TYPE

But then you don't get the value.
So join the result from this query with the original table.
SQL
WITH maxdate AS (
    SELECT MAX(TheDate) TheDate, Type
    FROM MyTable
    GROUP BY Type
    )
SELECT  t.TheDate, t.Type, t.Value
FROM    MyTable t join maxdate d
    ON  t.TheDate = d.TheDate
    AND t.Type = d.Type

Light moves faster than sound. That is why some people appear bright, until you hear them speak.
List of common misconceptions

GeneralRe: SELECT ... GROUP BY Error Pin
MikeDhaan26-Oct-11 5:14
MikeDhaan26-Oct-11 5:14 
GeneralRe: SELECT ... GROUP BY Error Pin
Jörgen Andersson26-Oct-11 23:46
professionalJörgen Andersson26-Oct-11 23:46 
GeneralRe: SELECT ... GROUP BY Error Pin
Jörgen Andersson27-Oct-11 0:09
professionalJörgen Andersson27-Oct-11 0:09 
GeneralRe: SELECT ... GROUP BY Error Pin
Blue_Boy26-Oct-11 5:00
Blue_Boy26-Oct-11 5:00 
AnswerRe: SELECT ... GROUP BY Error Pin
Chris Meech26-Oct-11 2:45
Chris Meech26-Oct-11 2:45 
GeneralRe: SELECT ... GROUP BY Error Pin
MikeDhaan26-Oct-11 4:23
MikeDhaan26-Oct-11 4:23 
GeneralRe: SELECT ... GROUP BY Error Pin
Chris Meech26-Oct-11 4:27
Chris Meech26-Oct-11 4:27 
GeneralRe: SELECT ... GROUP BY Error Pin
MikeDhaan26-Oct-11 4:57
MikeDhaan26-Oct-11 4:57 
GeneralRe: SELECT ... GROUP BY Error Pin
Mycroft Holmes26-Oct-11 5:03
professionalMycroft Holmes26-Oct-11 5:03 
GeneralRe: SELECT ... GROUP BY Error Pin
Chris Meech26-Oct-11 5:14
Chris Meech26-Oct-11 5:14 
GeneralRe: SELECT ... GROUP BY Error Pin
MikeDhaan26-Oct-11 5:29
MikeDhaan26-Oct-11 5:29 
GeneralRe: SELECT ... GROUP BY Error Pin
Mycroft Holmes26-Oct-11 14:01
professionalMycroft Holmes26-Oct-11 14:01 
GeneralRe: SELECT ... GROUP BY Error Pin
Jörgen Andersson26-Oct-11 23:56
professionalJörgen Andersson26-Oct-11 23:56 
AnswerRe: SELECT ... GROUP BY Error Pin
purnananda behera7-Nov-11 19:10
purnananda behera7-Nov-11 19:10 
Questionrestore mysql database from [Program Files] Pin
Jassim Rahma24-Oct-11 3:48
Jassim Rahma24-Oct-11 3:48 
AnswerRe: restore mysql database from [Program Files] Pin
Eddy Vluggen24-Oct-11 8:39
professionalEddy Vluggen24-Oct-11 8:39 
GeneralRe: restore mysql database from [Program Files] Pin
Jassim Rahma28-Oct-11 15:03
Jassim Rahma28-Oct-11 15:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.