Forum Replies Created

Viewing 15 posts - 3,331 through 3,345 (of 4,087 total)

  • RE: Add Date Specific MSRP to Orders Table

    I find that row number works better when you have a single table that you are trying to pull the most recent record from. When you have multiple tables,...

  • RE: Advice on BINARY_CHECKSUM or Alternatives

    SQL Kiwi (2/8/2012)


    drew.allen (2/8/2012)


    Peter Brinkhaus (2/7/2012)


    As an alternative, you could use NOT EXISTS (SELECT [@Stag].* INTERSECT SELECT [@Prod].*) to compare rows.

    Using EXCEPT should give you the same results, is probably...

  • RE: One thing I keep missing in SQL

    I don't know if it's "better" than a CTE, but you can use CROSS APPLY

    select

    A,

    ...

  • RE: Advice on BINARY_CHECKSUM or Alternatives

    Peter Brinkhaus (2/7/2012)


    As an alternative, you could use NOT EXISTS (SELECT [@Stag].* INTERSECT SELECT [@Prod].*) to compare rows.

    Using EXCEPT should give you the same results, is probably more efficient, and...

  • RE: Extended Latin Character - Need help on storing in my DB

    You need to make sure that your literal string is Unicode. Compare the following results where the first literal is ASCII and the second is Unicode.

    SELECT 'A a A...

  • RE: Help With Select Statement

    Take a look at EXCEPT which performs a set difference, which is what you are looking for. It makes it much clearer that you are doing a set difference...

  • RE: Database Issue--Please Help

    The SQL query is first compiled and then executed. Some SQL statements will allow you to use optimistic name resolution to refer to objects that have not yet been...

  • RE: One to Many Relationship Question - PLEASE HELP!

    Use an OUTER APPLY

    SELECT m.[property_id]

    ,m.[Address]

    ,m.[City]

    ,m.[Zip]

    ,m.County

    ,m.Bedrooms

    ,m.Bathrooms

    ,m.HalfBathrooms

    ,m.[V_O]

    ,m.[Stars]

    ,m.Rehab

    ,m.Open_bid

    ,m.Notes

    ,m.date_time_changed

    ,i.imagepaththumb

    FROM [Master] m

    OUTER APPLY (

    SELECT TOP (1) impagepaththumb

    FROM Image

    WHERE property_id = property_id_fk

    ) AS i

    where Active_Month='Y'

    ORDER BY m.[V_O] DESC

    ,m.date_time_changed desc

    ,m.[Address] ASC

    You could also use ROW_NUMBER(), but I...

  • RE: INSERT NUMBER OF ROWS BASED ON NUMBER VALUE IN ANOTHER TABLE COLUMN

    Martin Schoombee (1/27/2012)

    Take note though that it would require a triangular join, which is generally bad for performance.

    I wouldn't classify this as a triangular join. A triangular joins assumes...

  • RE: AS400 SQL Query

    mbrady5 (1/26/2012)


    How would you like to see some sample data? What format etc?

    See the following link.

    Forum Etiquette: How to post data/code on a forum to get the best help[/url]

    Drew

  • RE: Query help -

    In addition, I think you need to change the comparisons on these.

    Datediff(dd,receivedDate,getdate()) >= b.Days

    AND Datediff(dd,receivedDate,getdate()) < b.Days - 5

    By the law of transitivity, if n > d and d...

  • RE: Query help -

    Guras (1/26/2012)


    I am working on SQL server 2008 R2

    I have a table as following TableA

    clientcode | days

    101 | 30

    101 | 60

    105 | 15

    I need to build the...

  • RE: AS400 SQL Query

    Don't construct SQL commands in SSRS. Create a stored procedure and pass the SSRS parameters into the stored procedure.

    Do you really need both a FULL OUTER JOIN and a...

  • RE: Query Help...very slow running

    You're WHERE clause is not SARGable, because of the conversion of the timestamp field to character. Functions on fields generally prevent them from being SARGable, meaning that you cannot...

  • RE: aggregation, still learning how to produce results - please help #3

    Joe's posts on here have convinced me never to buy his books. He believes that he is being authoritative when he's just being authoritarian. He states opinion as...

Viewing 15 posts - 3,331 through 3,345 (of 4,087 total)