Forum Replies Created

Viewing 15 posts - 106 through 120 (of 1,082 total)

  • RE: Query is performing slow when sorted on datetime column

    Hi,

    Please could you save the graphical "Actual Execution Plan" as a .sqlplan zip it up and attach it.

    Also could we get index definitions for for the tables in your query.

    Without...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Unique parent rows with Child counts problem

    I'm pretty sure that sql you are writing is doing what it is supposed to do.

    It's just a matter or asking sql correctly 🙂

    but yeah I would say there is...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Unique parent rows with Child counts problem

    I can't see how that is possible as the field's don't match up to what you have posted as sample results...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Unique parent rows with Child counts problem

    what query did you use for that sample data?

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Please Help me for combining 2 select queries

    try this:

    --YOUR TABLE

    DECLARE @emp TABLE

    (ID INT IDENTITY(1,1),

    Name VARCHAR(10),

    AGE INT)

    --TEST DATA

    INSERT INTO @emp

    SELECT 'Kings',16 UNION ALL

    SELECT 'Wings',18 UNION ALL

    SELECT 'Sings',20 UNION ALL

    SELECT 'Things',22

    --SOLUTION

    SELECT id,Name as Field FROM @Emp UNION

    SELECT id,CAST(age as...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Unique parent rows with Child counts problem

    it all depends where your duplicates are coming from?

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: identity_insert on

    you need to list the columns you going to insert into:

    Insert into Table

    (ID ,Name ,LastName ,zoneID)

    Select ID, Name, LastName, Zone ID

    from OtherTable

    Where date >= '01/01/2009'

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Unique parent rows with Child counts problem

    could post some sample data of input and output data.

    Please also refer to the first link in my sig for posting , that will result in the faster help from...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Restrict recource usage on query?

    will also need to see the query as mentioned above but I have noticed that the table:

    "tblPEI_product" has many many Clustered Index Scans.

    there might be a way for us to...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Parameterized query oddness

    it could be parameter sniffing, search around here and you should find some good answers to it

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Subquery returned more than 1 value

    Sorry me again...

    Two other things I noticed in your query, and which out know the actual relationships and meanings of the tables/fields I might be wrong but...

    I have noticed that...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Subquery returned more than 1 value

    out of interest. am I correct in saying that this query should report the total financials per grouped by each place?, if so then you going to need to do...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Subquery returned more than 1 value

    exactly correct, see my example above try doing that will all the subqueries you basically just change the column alias from heat to say sewer etc and change the case...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Subquery returned more than 1 value

    ~The query is also a bit confusing I see you have GROUP BY clause but I can't find any aggreation functions in your select.

    So I'm guessing this is what you...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life
  • RE: Subquery returned more than 1 value

    The reason you would get an error like that is going to be down to one of the many correlated-subqueries you have in the select part of your query.

    because each...

    ----------------------------------------------
    Try to learn something about everything and everything about something. - Thomas Henry Huxley

    :w00t:
    Posting Best Practices[/url]
    Numbers / Tally Tables[/url]

    SQL-4-Life

Viewing 15 posts - 106 through 120 (of 1,082 total)