Forum Replies Created

Viewing 15 posts - 91 through 105 (of 172 total)

  • RE: Need help with SELECT statement against unusual table...

    Not sure you are providing all of your business rules, but... here goes

    select customer_id

    from unusualTable

    where (field_number = 1 and field_value = 'BLUE')

    OR ( field_number = 3 and field_value=...

  • RE: Making a Game in T-SQL

    Suduko solver may be for you!

    A SqlServerCentral article a last year was a walk-through for creating a Suduko solver. I was/am a sudoko nut so instead of...

  • RE: Insert Select Summary

    1 - Condolences for having a 7 piece Primary Key. Shot the key creator, now.

    2 - There should be rules in place if you have multiples (max, sum, min,...

  • RE: WIts End

    If the VB program is working correctly why would the program 'run into problems' when you were reading more then one record? This does not sound like a SQL...

  • RE: use NOT IN for multiple fields?

    (DUH) think homer simpson

    no need for derived table

    SELECT Type_ID

    FROM Db1.dbo.TypeTable t1

    LEFT JOIN

    Db2.dbo.TypeTable) t2

    ON t1.field1 = t2.field1 and t1.f2 = t2.f2 and t1.f3 = t2.f3

    WHERE t2.field1 is null

  • RE: use NOT IN for multiple fields?

    NOT IN does not allow multiple choices.

    The following Join logic MAY get you the logic you want.

    SELECT Type_ID

    FROM Db1.dbo.TypeTable t1

    LEFT JOIN

    (SELECT Field1, Field2, Field3

    FROM Db2.dbo.TypeTable) t2

    ON t1.field1...

  • RE: Linked Server Error: Cannot obtain the schema rowset "DBSCHEMA_CATALOGS"

    This may or may not be relevant. But...

    Glancing through the error message it appears your are attempting to link to server "(null)", this is in the error message twice.

    Are...

  • RE: Invalid column name error

    Step one - refacture names (doc_number =order_no??)

    Step two - make the first temp table a derived table

    Select Case When Right(doc_number,2) '00' Then 'Nope'

       Else doc_number End As order_no

    Into...

  • RE: Distinct and Max

    select email, max(lastDate)

    from XTable

    GROUP by email

  • RE: Problem using ROW_NUMBER() OVER () with Sub-Queries

    I just love row_number() so i will go on... (and on...)

    Example of Row_number()

    To find the average value of the last three listings/offers by house/listingid

    declare @HouseList table(id INT IDENTITY, listingID INT,...

  • RE: Problem using ROW_NUMBER() OVER () with Sub-Queries

    row_number is designed to insert a column that is an integer (pseudo identity) that you can use to get only the latest, last 3, last 10...

    I use it myself for...

  • RE: Problem using ROW_NUMBER() OVER () with Sub-Queries

    Row_number is populating column rowNum.

    In your where statement add [Where rowNum = 1]. This if designed correctly will limit you result set to only the data you want.

    Once you...

  • RE: Problem using ROW_NUMBER() OVER () with Sub-Queries

    The order by in the Row_number() is for assigning values for the RowNum column.

    You now have a table an additional column rowNum assigned a value by the order by. ...

  • RE: Error....

    Your when statement is only a string

    when 'string here'

    It appears you are trying to

    when exists(select yada from yadatable where yada1 = yada2)

    then 'y' else 'n' end

    The ticks are turning...

  • RE: Help in One Query

    It sounds like you are looking for a Pivot Table solution. Perform a search on pivot tables in the TSQL (2k & 2k5) areas. You should find LOTS...

Viewing 15 posts - 91 through 105 (of 172 total)