Forum Replies Created

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

  • Reply To: query one table three for three different where variables

    Yes, Aaron, that is correct. I need it to display the three dates and the associated data in new columns. Reading up on CrossTab I think you and are correct....

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: query one table three for three different where variables

    Thanks Scott. Sorry for the delay. Took a few days away!

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: query one table three for three different where variables

    Scott, I have been reading on PIVOT. Would this  be more appropriate for what I am trying to accomplish?

     

    Thanks,

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: query one table three for three different where variables

    Scott, I run the query and still is only returning one line of data when it should be 100 or more. And it is only showing for the 31st of...

    • This reply was modified 3 years, 8 months ago by brian.cook.

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: query one table three for three different where variables

    Cool, that solved that error and it returns for Day 1. Do I repeat this for the other two sub queries or am I missing something here, as this is...

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: query one table three for three different where variables

    Hi Scott, getting an error on Column not found in this piece;

    MAX(CASE WHEN month = @month AND year = @year THEN ControlPointName END)

    That one is part of the table....

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: query one table three for three different where variables

    Mike using what you provided , here is how my query looks now. I was able to eliminate the UNIONS, and make the script smaller.

    USE tmdsDatabaseStatistics

    DECLARE @year...

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: query one table three for three different where variables

    Mike, I think you made a type-o. If I change it to look like this;

    SELECT * 
    FROM [tmdsDatabaseStatistics].[dbo].[tblStatisticsLocationDay]
    WHERE ControlPointName = 'CHEROKEE'and ControlPointName NOT...

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: query one table three for three different where variables

    Mike, the day value is always the 1st and 15, however the third date is variable. it depends on the date  that the user runs the script. i.e. it could...

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: query one table three for three different where variables

    Hi ratbak. Yes all three  are always populated.

    Not familiar with a Self-join

     

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: Query first of month with results and query current date and compare

    Thanks,

    After I wrote this, I realized I had this one figured out.

    Sorry, too many days on the same project and keep getting stuff dumped on me to add or change.

     

    Appreciate...

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: Query Table without index

    Scott,

    WHERE g.Year = @year and g.Month = @month AND g.FailureCount <> 0

    Only returns lines with the High FailureCount values. It does not return any lines with the changed values.

     

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: Query Table without index

    Jeff,

    Here is an example of the data for one location for a single days statistics with some explanation;

    As for query output for a single day, it generates almost 95000 lines...

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: Query Table without index

    I need to show for example that at hour null/zero it was a value of '0' and lets say at hour one it climbs to the positive number and then...

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

  • Reply To: Query Table without index

    Here is an example where it goes from a NULL value to a Positive number then a Negative number in a three hour period.

    WD 1116.0 (HILINE)1413HI LINE2022816386610
    WD...

    Retired Navy Chief Petty Officer, Consulting Systems Engineer, C# Programmer, SQL Beginner

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