Forum Replies Created

Viewing 15 posts - 1,186 through 1,200 (of 1,228 total)

  • RE: Query multiple descriptions from single field of codes

    There's yet another way to do this if you want an output row for each code - with OR in the join to the lookup. This isn't often recommended because...

  • RE: Query Construction

    mail 41752 (1/23/2010)


    Can this be accomplished with a single SELECT statement...?

    Yes.

    DROP TABLE #Table1

    CREATE TABLE #Table1 (FieldA INT, FieldB INT)

    INSERT INTO #Table1 (FieldA, FieldB)...

  • RE: Query multiple descriptions from single field of codes

    Here's a completely different way which returns the codes in the same row.

    CREATE TABLE #A (id INT, FCode CHAR(10))

    INSERT INTO #A

    SELECT...

  • RE: Not getting desired results

    SELECT c.crs_id AS id,

    crs_name,

    crs_author,

    sch_start,

    sch_end,

    intro,

    recorded,

    edit_av,

    [time], ...

  • RE: Query optimization

    lmu92 (1/23/2010)


    I would use the UNION operator (or even UNION ALL if possible) inside a CTE to get all values except AssetTypeName and join the CTE to the AssetType table.

    I...

  • RE: Query optimization

    ALTER VIEW [dbo].[vw_AssetCommonDetail]

    AS

    SELECT d.AssetID, d.Location, d.Tower, d.[Floor], d.Cubicle, d.BaseVendor, d.Vendor, d.AssetType, d.AssetUser, a.AssetType

    FROM (

    SELECT DISTINCT AssetID, Location,Tower,[Floor],Cubicle, BaseVendor, Vendor, AssetType, AssetUser

    FROM Blackberry

    UNION

    SELECT DISTINCT AssetID,...

  • RE: how to get only duplicate rows from table

    Strong hint!

    Write a query which returns the following result set:

    malli 2

    reddy 2

    - then post it here.

  • RE: SQL SERVER 2008 Pivot

    That's because @PivotCliPadres variable is too short, the value is truncated.

    However, @PivotCliPadres contains duplicate values, even if PIVOT can deal with this, it's almost certainly not what you want.

    Can I...

  • RE: Integer bigger than bigint?

    We use three tables for this:

    an Item table with pk ItemID

    a Category table with pk CategoryID

    an ItemCategory table with pkItemCategory and fk's ItemID and CategoryID

    There are no limits (to...

  • RE: SQL SERVER 2008 Pivot

    NY, NY - so good they named it twice. Ok, are you entirely happy with these results? Is the data exactly what you would expect to see?

  • RE: Sub Query returning multiple rows for particular inputs

    Those six correlated subqueries all point (correlate) to the same row in table tblstatusmaster, so why not change the query so that tblstatusmaster is LEFT JOINed in the FROM list...

  • RE: Can I use UNPIVOT in this case?

    Could you use unpivot for this? I'm sure you could, if you were to pivot the data first. You don't need to, it's a very simple requirement:

    SELECT *

    FROM (

    ...

  • RE: Procedure with variables Null should be all

    The LIKE is not necessary.

    WHERE o.uid = ISNULL(@Var, o.uid)

    AND indid IN (0, 1, 255)

    AND o.type = 'U'

  • RE: Query-Select the first 5 characters in a field?

    This is probably a quick and dirty fix until your developer is available, but you could try the LEFT function as follows:

    select tm.Title, tm.primary_id ISBN13,

    cust_D, c.Name, Doc_Ref INVOICE_ID,

    isnull( sum(BO.DEL_QTY),0) BO_DEL_QTY,

    isnull(sum(BO.UNS_QTY),0)...

  • RE: How do you limit records using Distinct and Count - TOP and Rowcount dont work ?

    ifila (1/13/2010)


    I dont have a 'rowid' column on my table. Is the only solution to add this to my table as a workaround?

    No. You don't need it at all. But...

Viewing 15 posts - 1,186 through 1,200 (of 1,228 total)