Click here to Skip to main content
15,897,371 members
Home / Discussions / Database
   

Database

 
GeneralRe: Help in creat this Sql Pin
Mangore7529-Dec-08 5:27
Mangore7529-Dec-08 5:27 
QuestionHow to substring the following Pin
dabuskol27-Dec-08 19:47
dabuskol27-Dec-08 19:47 
AnswerRe: How to substring the following Pin
Wendelius27-Dec-08 22:00
mentorWendelius27-Dec-08 22:00 
AnswerRe: How to substring the following Pin
Khawar Abbas129-Dec-08 20:22
Khawar Abbas129-Dec-08 20:22 
QuestionOnly include the latest rows Pin
Tony Pottier27-Dec-08 9:48
Tony Pottier27-Dec-08 9:48 
AnswerRe: Only include the latest rows Pin
Wendelius27-Dec-08 10:01
mentorWendelius27-Dec-08 10:01 
GeneralRe: Only include the latest rows Pin
Tony Pottier27-Dec-08 10:29
Tony Pottier27-Dec-08 10:29 
GeneralRe: Only include the latest rows Pin
Wendelius27-Dec-08 10:37
mentorWendelius27-Dec-08 10:37 
Tony_P wrote:
Is subquerying the only solution


No it's not. I think there are several ways.

Depending on your indexing an inline view may be faster. Then it would be something like:
SELECT COUNT(*), SUM(price)
FROM (SELECT TOP 50 Price
      FROM   Orders
      WHERE cust_id=3
      ORDER BY date DESC) tableAlias

Check the execution plan to see which one is better in your case. Additionally add relevant indexes if you need.

The need to optimize rises from a bad design.My articles[^]

GeneralRe: Only include the latest rows Pin
Tony Pottier27-Dec-08 10:48
Tony Pottier27-Dec-08 10:48 
GeneralRe: Only include the latest rows Pin
Wendelius27-Dec-08 11:01
mentorWendelius27-Dec-08 11:01 
Question[Message Deleted] Pin
hatan8627-Dec-08 9:44
hatan8627-Dec-08 9:44 
AnswerRe: MS Access Database update error help Pin
Wendelius27-Dec-08 9:50
mentorWendelius27-Dec-08 9:50 
GeneralRe: MS Access Database update error help Pin
hatan8627-Dec-08 10:19
hatan8627-Dec-08 10:19 
GeneralRe: MS Access Database update error help Pin
Wendelius27-Dec-08 10:27
mentorWendelius27-Dec-08 10:27 
QuestionI want to discuss about a web project.Can I? Pin
R111927-Dec-08 3:41
R111927-Dec-08 3:41 
AnswerRe: I want to discuss about a web project.Can I? Pin
Colin Angus Mackay27-Dec-08 10:36
Colin Angus Mackay27-Dec-08 10:36 
GeneralRe: I want to discuss about a web project.Can I? Pin
Jon_Boy30-Dec-08 14:29
Jon_Boy30-Dec-08 14:29 
GeneralRe: I want to discuss about a web project.Can I? Pin
Colin Angus Mackay30-Dec-08 15:10
Colin Angus Mackay30-Dec-08 15:10 
GeneralRe: I want to discuss about a web project.Can I? Pin
Colin Angus Mackay30-Dec-08 15:14
Colin Angus Mackay30-Dec-08 15:14 
AnswerRe: I want to discuss about a web project.Can I? Pin
Colin Angus Mackay27-Dec-08 10:42
Colin Angus Mackay27-Dec-08 10:42 
AnswerRe: I want to discuss about a web project.Can I? Pin
Rob Graham28-Dec-08 5:31
Rob Graham28-Dec-08 5:31 
AnswerRe: I want to discuss about a web project.Can I? Pin
Jon_Boy30-Dec-08 14:25
Jon_Boy30-Dec-08 14:25 
QuestionQuery Question Pin
gnjunge25-Dec-08 3:17
gnjunge25-Dec-08 3:17 
AnswerRe: Query Question Pin
Wendelius25-Dec-08 7:06
mentorWendelius25-Dec-08 7:06 
QuestionRe: Query Question Pin
gnjunge25-Dec-08 20:57
gnjunge25-Dec-08 20:57 

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.