Click here to Skip to main content
15,926,596 members
Home / Discussions / Database
   

Database

 
Generalsql query Pin
sandhya1429-Jan-08 0:24
sandhya1429-Jan-08 0:24 
GeneralRe: sql query Pin
alexrad29-Jan-08 0:38
alexrad29-Jan-08 0:38 
GeneralRe: sql query Pin
sandhya1429-Jan-08 0:44
sandhya1429-Jan-08 0:44 
GeneralRe: sql query Pin
alexrad29-Jan-08 0:53
alexrad29-Jan-08 0:53 
QuestionHow to get a multi colum select with one colum SELECT DISTINCT with only one command ? Pin
fracalifa29-Jan-08 0:24
fracalifa29-Jan-08 0:24 
AnswerRe: How to get a multi colum select with one colum SELECT DISTINCT with only one command ? Pin
Kschuler29-Jan-08 4:40
Kschuler29-Jan-08 4:40 
GeneralRe: How to get a multi colum select with one colum SELECT DISTINCT with only one command ? Pin
fracalifa29-Jan-08 21:41
fracalifa29-Jan-08 21:41 
GeneralRe: How to get a multi colum select with one colum SELECT DISTINCT with only one command ? Pin
Kschuler30-Jan-08 3:21
Kschuler30-Jan-08 3:21 
You can accomplish it with something like this:

SELECT order_id, MAX(date) FROM tablename GROUP BY order_id

The idea is that you will return one order_id and the largest date with that order_id. I know it would work for a number, I'm just not sure how a date reacts to the MAX() function...you could also use MIN if you want the smallest date...and if you did this

SELECT order_id, MAX(date), COUNT(*) FROM tablename GROUP BY order_id

It would also display how many dates exist for that order id.

So maybe you need to do some research on GROUP BY and how it affects date datatypes.

Hope this helps.
GeneralRe: How to get a multi colum select with one colum SELECT DISTINCT with only one command ? Pin
fracalifa30-Jan-08 4:40
fracalifa30-Jan-08 4:40 
AnswerRe: How to get a multi colum select with one colum SELECT DISTINCT with only one command ? Pin
Pete O'Hanlon29-Jan-08 5:07
mvePete O'Hanlon29-Jan-08 5:07 
GeneralSingle quote error in tsql statement Pin
veereshIndia28-Jan-08 22:22
veereshIndia28-Jan-08 22:22 
GeneralRe: Single quote error in tsql statement Pin
alexrad28-Jan-08 23:32
alexrad28-Jan-08 23:32 
General[Message Deleted] Pin
trilokharry28-Jan-08 17:52
trilokharry28-Jan-08 17:52 
GeneralRe: to get day, month, year seperate from date format Pin
Tobias Schoenig28-Jan-08 19:30
Tobias Schoenig28-Jan-08 19:30 
GeneralRe: to get day, month, year seperate from date format Pin
trilokharry28-Jan-08 20:01
trilokharry28-Jan-08 20:01 
GeneralRe: [Message Deleted] Pin
Colin Angus Mackay29-Jan-08 2:53
Colin Angus Mackay29-Jan-08 2:53 
QuestionMigrate MySQL to SQL Server 2000 or 2005??? Pin
code-frog28-Jan-08 16:20
professionalcode-frog28-Jan-08 16:20 
Questionour forum has msgs > 8K Pin
shefali_sinha28-Jan-08 11:06
shefali_sinha28-Jan-08 11:06 
GeneralRe: our forum has msgs > 8K Pin
Mark Churchill28-Jan-08 13:34
Mark Churchill28-Jan-08 13:34 
GeneralRe: our forum has msgs > 8K Pin
shefali_sinha10-Feb-08 12:29
shefali_sinha10-Feb-08 12:29 
GeneralRe: our forum has msgs > 8K Pin
Mark Churchill10-Feb-08 12:59
Mark Churchill10-Feb-08 12:59 
GeneralStoring Temp Data to a View Pin
dboy22128-Jan-08 6:11
dboy22128-Jan-08 6:11 
QuestionRe: Storing Temp Data to a View Pin
Mike Ellison28-Jan-08 14:40
Mike Ellison28-Jan-08 14:40 
Generalsql 3624 Pin
alexrad28-Jan-08 6:05
alexrad28-Jan-08 6:05 
GeneralRe: sql 3624 Pin
pmarfleet28-Jan-08 8:25
pmarfleet28-Jan-08 8:25 

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.