Forum Replies Created

Viewing 15 posts - 331 through 345 (of 902 total)

  • RE: problem with join T-Sql

    Having reformated the query at the bottom of the code you submited

    select distinct

    customer.*

    ,CustomerColor.Color

    ,CustomerColor.CustomerSubject

    ,b.AkharinKeraye

    ,b.Karkard

    ,b.Lcall

    from customer

    left outer join CustomerColor on Customer.CustomerColorID=CustomerColor.CustomerColorID

    ,(select [Service].CustomerID

    ,max([Service].SabtDate) as Lcall

    ,SUM(Service.Gheymat) as Karkard

    ,(select s.Gheymat

    from...

  • RE: Count Rows within a Query

    You need to alias the Inner select

    Eg

    select count (*)

    from

    (SELECT top 100 percent Form.FormName, Markets.MarketName

    FROM Form INNER JOIN

    FormMarkets_Link ON Form.FormID = FormMarkets_Link.ptFormID INNER JOIN

    Markets ON FormMarkets_Link.ptMarketID = Markets.MarketID CROSS...

  • RE: Cumulative SUM by HOUR for specific DATE range

    Chris,

    I've never seen the recursive CTE method before, and looks like a viable option to the quirky update to a point.

  • RE: Cumulative SUM by HOUR for specific DATE range

    You might wnat to revisit the code, I would suggest reading this article http://www.sqlservercentral.com/articles/T-SQL/61539/ and then look at a turning this into a Quirky update for the Running total, something...

  • RE: T-SQL vs SQL differences

    I think the problem with most MS based training courses is that they often focus on only the new shiny-shiny toys that you get, eg in T-SQL for 2012 these...

  • RE: Test design

    Mike John (2/11/2013)


    Without a detailed description of your business requirments, plus proper definitions and descriptions of what each of those tables and columns actually represents I don't think anyone can...

  • RE: While/Loop Help

    Bruce W Cassidy (2/8/2013)


    Lynn Pettis (2/7/2013)


    Better advice, yes, but hard to follow if the boss says you must use them.

    declare @success bit;

    exec CurriculumVitae_prepare;

    while (1=1) begin

    exec Job_Apply...

  • RE: How to get required SQL Result Set..?

    You probably want to look at using SSIS with Excel as a destination.

  • RE: how to count in sql?

    this

    select top 100 ID,

    count (*)

    from [database]..

    group by id

    order by count (*);

    should be

    select top 100 ID,

    count (*) myCount

    from [database]..

    group by id

    order by myCount;

    to order by the Count...

  • RE: Sort by/Order By

    I believe Gail had this in mind,

    SELECT

    CalendarMonth

    , CaldendarDate

    From Table

    Order by CalendarMonth

    By Default the data is ordered ASCENDING, NOTE : varchar/char (etc) fields will sort differently depending on factors such...

  • RE: Merge statement with openrowset

    BOL states that OpenRowSet can be used as a Target in the merge but appears to be ambiguous as to whether it can be a source.

    Have you tried loading...

  • RE: Query Help

    If I understand correctly the Second statement shouldnt run if the first statement updates rows, if it doesnt update any rows then the second statement should run, if that is...

  • RE: Adding new columns to a table using the datepart function SQL

    Sean, I've alread shown a simle proof for Tally vs Loop on this thread (http://www.sqlservercentral.com/Forums/Topic1416507-1292-1.aspx) on

    Unfortunately hes been told to use the While loop by his boss. My...

  • RE: My first UDF doesn't work. Thoughts?

    Dont you have it insert the data into the return table @retCHFPatients?

    so I think your select should read something like

    INSERT INTO @retCHFPatients

    SELECT

    @MonthNumber = month(a.DischargeDateTime),...

  • RE: Adding new columns to a table using the datepart function SQL

    good luck, I hope this is being used as a 'wrong' way of doing something rather than the right way.

    I would pick up a couple of books on SQL programming,...

Viewing 15 posts - 331 through 345 (of 902 total)