Forum Replies Created

Viewing 15 posts - 31 through 45 (of 582 total)

  • RE: join two tables

    It's not clar what you are trying to do. Why do you want to return

    Jill, 123, 'test' , 1, 8

    Jill, 321, 'these', 1, 8

    ? What is the logic...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Problem with LEFT JOIN

    The hardcoded student ID is irrelevant. It's only there for simplicity. Obviously the query is not very versatile if that value (both occurrences) isn't replaced with a variable. But it's...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Conditionally Incrementing a Counter in a While Loop

    If it doesn't matter which 10 you update,

    update top 10 n
    set c = 'x'
    from tablen n
    where id % 2 = 0

    if it...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Problem with LEFT JOIN

    Yes, as I would expect. But the poster says the query I posted (which is like your first one) still doesn't work, i.e. still excludes the unmatched record. If teh...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Problem with LEFT JOIN

    I can only post the same code again:

    select sat.AttendanceTyID
    , sat.Description
    , sar.AttendanceRuID
    , 169 StudentID
    , sar.AttendanceDate
    ,...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Conditionally Incrementing a Counter in a While Loop

    Do you expect a lot of failed updates? Do you need to do them as a series of individual transactions? If not, why not just do teh updates as a...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Problem with LEFT JOIN

    I agree that that was the problem with the original code:

    where sar.companyID= 1370 and sar.studentID = 169 and termID is null

    But the versions posted fixed that...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Problem with LEFT JOIN

    The only change I can think of is to my previous code is to put the 'termID is null' in the join. But that shouldn't be able to increase...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Problem with LEFT JOIN

    can you paste the exact code you ran?

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Per hour calculations using timestamps and total widgets

    The code as it stands should limit results to a single day, using the @date variable. You can get rid of operator by removing it from the SELECT list and...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Trying to get asp to display sql query

    It is relevant - because depends what you are using to render reports from the data, what data you need to return. You might be able return smaller parent and child recordsets...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Problem with LEFT JOIN

    What result does this give?

     
    select sat.*
    from SchoolAttendanceTy sat

    where sat.companyID=1370

    and sat.AttendanceTyID = 2
    --if this column...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Need help with the query

    I thought you also wanted a crosstab/pivot table...?

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Problem with LEFT JOIN

    select sat.AttendanceTyID
    , sat.Description
    , sar.AttendanceRuID
    , 169 StudentID
    , sar.AttendanceDate
    , isnull(sar.RollupCount,0) RollupCount
    from SchoolAttendanceTy sat
    left join SchoolAttendanceRU sar

    on...

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

  • RE: Calculating the time difference between consecutive records in a RecordSet

    Just out of interest, here's another test which suggests the opposite:

    IF

    Object_ID('[test_dt]') IS NOT NULL

    DROP

    Tim Wilkinson

    "If it doesn't work in practice, you're using the wrong theory"
    - Immanuel Kant

Viewing 15 posts - 31 through 45 (of 582 total)