Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 1234»»»

select query Expand / Collapse
Author
Message
Posted Thursday, January 28, 2010 12:59 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 10:54 PM
Points: 430, Visits: 1,068
i need a select query for below.

there is 3 date colums in a table.
how to find out the greatest value from these 3 columns.
Post #855592
Posted Thursday, January 28, 2010 1:03 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 7:28 AM
Points: 6,841, Visits: 13,361
Sounds like homework.

If not, please provide sample data, expected result and what you've tried so far as described in the first link in my signature.




Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #855594
Posted Thursday, January 28, 2010 1:06 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 10:54 PM
Points: 430, Visits: 1,068
selecting one greatest value from 3 coloumns.?
Post #855597
Posted Thursday, January 28, 2010 1:07 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 10:54 PM
Points: 430, Visits: 1,068
selecting one greatest value from 3 coloumns in a table.?
Post #855598
Posted Thursday, January 28, 2010 1:10 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 7:28 AM
Points: 6,841, Visits: 13,361
charipg (1/28/2010)
selecting one greatest value from 3 coloumns in a table.?

Yes.
How about sample data including your current query as requested before?




Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #855601
Posted Thursday, January 28, 2010 1:13 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Sunday, November 4, 2012 12:23 PM
Points: 1,893, Visits: 3,932
Try MAX with an included CASE WHEN.

Greets
Flo



The more I learn, the more I know what I do not know
Blog: Things about Software Architecture, .NET development and T-SQL

How to Post Data/Code to get the best Help How to Post Performance Problems
Post #855603
Posted Thursday, January 28, 2010 1:14 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 10:54 PM
Points: 430, Visits: 1,068
I am not able to provide the sample data.

can you pls provide the sample query?
Post #855604
Posted Thursday, January 28, 2010 1:15 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Sunday, November 4, 2012 12:23 PM
Points: 1,893, Visits: 3,932
charipg (1/28/2010)
I am not able to provide the sample data.

can you pls provide the sample query?

?



The more I learn, the more I know what I do not know
Blog: Things about Software Architecture, .NET development and T-SQL

How to Post Data/Code to get the best Help How to Post Performance Problems
Post #855606
Posted Thursday, January 28, 2010 1:19 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 7:28 AM
Points: 6,841, Visits: 13,361
charipg (1/28/2010)
I am not able to provide the sample data.

can you pls provide the sample query?


You don't have to provide your real data. Get the basic concept and transform it into a sample table with fake column names and fake values. But make sure it represents what you're struggling with.

Please remember we don't see what you see. So you have to help us help you.




Lutz
A pessimist is an optimist with experience.

How to get fast answers to your question
How to post performance related questions
Links for Tally Table , Cross Tabs and Dynamic Cross Tabs , Delimited Split Function
Post #855609
Posted Thursday, January 28, 2010 1:37 PM
SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: 2 days ago @ 10:54 PM
Points: 430, Visits: 1,068
Please correct the below query..........

select max(myDate) from

( select field_1 myDate from myTable

union all

select field_2 myDate from myTable

union all

select field_3 myDate from myTable)
Post #855620
« Prev Topic | Next Topic »

Add to briefcase 1234»»»

Permissions Expand / Collapse