Forum Replies Created

Viewing 15 posts - 691 through 705 (of 1,217 total)

  • RE: Need help with the query

    OK, most probably you'll have a table Customers somewhere. You can use that to find out who has ordered both:

    SELECT COUNT(distinct c.CustID)

    FROM Customers c

    JOIN Orders o ON o.CustID = c.CustID...

  • RE: lock a subset of a table from update or insert

    If problem is excluding new inserts, then I would store the ID's of the summarized rows from table A somewhere (in a temp table for example) or use a status...

  • RE: Help with SELECT Statement

    Hello,

    this should be what you are looking for:

    SELECT r.ID, r.received, r.status, MAX(CASE WHEN r.status = 'Closed' THEN t.AuditDateTime ELSE NULL END) as dateclosed

    FROM #Requests r

    LEFT JOIN #RequestAuditTrails t ON t.requestID=r.ID...

  • RE: A Question on IsPersisted Property of Computed Columns

    Hello Afendi,

    if your problem relates to SQL2005, it would be better to post it in SQL2005 section of the forums. You'd have much higher probability of getting a reply quickly...

  • RE: The Support Joke

    Hey Steve, that was long ago... no wonder they had problems with what is what. I had a similar thing happen to me some 6 years ago (we had desktops at...

  • RE: sequencing the column with group by v2

    Taking advantage of the first part of Sergiy's solution, but with different way of getting the sequence number (works well with sample data posted by Peter Larsson):

    declare @tableA table (a int,...

  • RE: You comment needed regarding orphaned records

    My opinion:

    Do not delete any products at all, or at least not when the product is used in an order.

    Generally, it is possible to delete a product that you have...

  • RE: i want yesterdays''''record if today''''s

    I guess we need more info... this is open to various interpretations

    "IF there is nothing for today then it must fetch yesterday's records"

    I would understand that requirement differently than Peter...

  • RE: Help me: position of column instead of name or alias column name

    "So use this at your own risk - in my opinion, if you don't know what the name of a column in a table is when you're writing a query,...

  • RE: query: reference query columns from within query

    Yes, there are only two ways to handle this situation. Either you have to repeat the entire calculation of [Finding Cost $/BOE] column, or you have to use derived table....

  • RE: retrieving not null columns...

    Hello Barath,

    your question suggests that the data model is incorrect, or we are missing something. What is the reason for the desired output? What if one of the rows has...

  • RE: Need help writing query

    Yeah, sp_makewebtask is great. We're using it for most checks and reports... started with it some time ago because it is easy to incorporate the HTML result into a mail...

  • RE: Anyone have ideas how to solve deadlock problems

    IMHO in case of bad performance due to hardware, deadlocks can be greater nuisance because every action requires more time - but the reason of deadlocks is still bad code. Problems...

  • RE: Problem calling a function within a SELECT

    Read the link Sergiy posted, it should explain the situation.

    To be more specific, source of error is here:

    FROM dbo.GetAssessmentStatusRows(1920, S.ScheduleID )

    You are using a function...

  • RE: Looping?

    If you decide to delete the rows (I agree with Jeff that copy/rename is often the best way to do this), one possibility is to create a job - using...

Viewing 15 posts - 691 through 705 (of 1,217 total)