Forum Replies Created

Viewing 15 posts - 76 through 90 (of 458 total)

  • Reply To: Lost relationships

    That someone would have to be me. I do get warnings about changes, sometimes, but I don't recall any about dropping relationships. Would it say so specifically, or does it...

  • Reply To: Lost relationships

    Good article - thank you. I read through it and created the table and database trigger as it says. Seems to work just right - I removed one of my...

  • Reply To: Group and Max combination

    ChrisM@Work wrote:

    Here's exactly what I meant by using Paul White's method to grab the first column values only, then using that result set as the source for further processing. The...

  • Reply To: Group and Max combination

    ScottPletcher wrote:

    I can understand SQL having to scan the table / index, but I don't see why SQL would need to do a sort.  Btw, an asc index will do,...

  • Reply To: Group and Max combination

    I can't believe this is so damn difficult. In words, "Read this index, in the order in which it already exists, and return each occurrence of the last values of...

  • Reply To: Group and Max combination

    No luck. I've been beating my head against my desk for hours, trying all sorts of correlated subqueries and CTEs.

    Most of them don't work at all, and the few that...

  • Reply To: Group and Max combination

    ChrisM@Work wrote:

    Here's one way of obtaining the distinct first-column values without performing an index scan.

    https://www.sqlservercentral.com/forums/topic/calculating-interest-query/page/4/#post-1244493

    I'm looking at that, but it's not going well. I have three columns, not one, and...

  • Reply To: Group and Max combination

    Here is the latest index, specifically for this query only.

    CREATE NONCLUSTERED INDEX [ix_MaxDruhaEvidence] ON [dbo].[Podrobnosti]
    (
    [EvidenceLetter] deSC,
    [EvidenceNumber] deSC,
    [EvidenceExtra] deSC
    )

    WHERE ([EvidenceLetter]<>'1e')
    WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB =...
  • Reply To: Group and Max combination

    Jeez - I'm going senile. I read the index name wrong. Here is the correct index def, that it is actually using.

    CREATE NONCLUSTERED INDEX [ix_AkcDruhaEvidence] ON [dbo].[Podrobnosti]
    (
    [AkcesAutoID]...
  • Reply To: Group and Max combination

    All the indexes show non-clustered. I'm sure I had a clustered index on this originally, but I've done a good bit of expermenting with this table, and probably forgot this...

  • Reply To: Group and Max combination

    Oh yeah, I forgot about the filter. It's actually the same filter as is used in my original query, but I forgot to put it back in when testing this...

  • Reply To: Group and Max combination

    ChrisM@Work wrote:

    I think the optimiser doesn't use the index because there's no benefit in doing so. If you scale up the row count to something sensible and add a column...

  • Reply To: Group and Max combination

    pdanes wrote:

    ScottPletcher wrote:

    The max list is easy enough to produce.  Sorry, I don't fully understand the 'OK' part well enough yet to add that to the query.  'OK' just meaning...

    • This reply was modified 5 years, 1 month ago by pdanes.
  • Reply To: Group and Max combination

    pdanes wrote:

    ChrisM@Work wrote:

    pdanes wrote:

    ChrisM@Work wrote:

    SELECT a, MAX(CAST(b AS varchar(2)) + c) 
    FROM (VALUES
    ('A', 1, 'a'),
    ('A', 1, 'b'),
    ('A', 1, 'c'),
    ('A', 2, 'a'),
    ('B', 1, ''),
    ('B', 1, 'a'),
    ('B', 1,...
  • Reply To: Group and Max combination

    ChrisM@Work wrote:

    pdanes wrote:

    ChrisM@Work wrote:

    SELECT a, MAX(CAST(b AS varchar(2)) + c) 
    FROM (VALUES
    ('A', 1, 'a'),
    ('A', 1, 'b'),
    ('A', 1, 'c'),
    ('A', 2, 'a'),
    ('B', 1, ''),
    ('B', 1, 'a'),
    ('B', 1, 'b'),
    ('B',...

Viewing 15 posts - 76 through 90 (of 458 total)