Results 1 to 7 of 7

Thread: T-SQL Help

  1. #1
    Join Date
    Jul 2004
    Posts
    191

    Unanswered: T-SQL Help

    I have a table that
    have three ID fields

    In order to find certain folders the three have to equal to one another.

    XX_ID = XXX_ID = XXXX_ID

    My query goes like this:

    Select PRJ_NAME
    From GROUP.PROJECTS
    WHERE XX_ID = XXX_ID (How do I add XXXX_ID)
    And PRJ_OWNER = 'XXXXXX'

    Thanking you in advance.

    Lystra

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Select PRJ_NAME
    From GROUP.PROJECTS
    WHERE XX_ID = XXX_ID
    and XX_ID = XXXX_ID
    And PRJ_OWNER = 'XXXXXX'
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Jul 2004
    Posts
    191
    Thanks, but I think the problem is with how the value is.

    For example

    xx_id = 2148.0
    xxx_id = 2148
    xxxx_id = 2148.0 (should I convert the value??)

    In order to get the main folder in the database xx_id =xxx_id which is fine, I am able to get records. To get the subfolders name I need to add xxxx_id which get me no records. I don't know what the problem is.

  4. #4
    Join Date
    Jul 2004
    Posts
    191
    also, the data type is:

    xx_id float
    xxx_id float
    xxxx_id int

    I hope this is helpful

    thanks

  5. #5
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Equality works regardless of datatype.

    Please post the query you are using that is not returning the results you expect.
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  6. #6
    Join Date
    Jul 2004
    Posts
    191
    Select PRJ_ID, PRJ_PID,PRJ_NAME, PRJ_OWNER, TREE_ID
    From GROUP.PROJECTS
    WHERE PRJ_ID = TREE_ID
    and PRJ_ID = PRJ_PID
    And PRJ_OWNER = 'xxxxxx'

  7. #7
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    You show xxxx_id = 2148.0 in one post, but in a later post claim that xxxx_id is an integer datatype.

    That makes no sense.

    Regardless, SQL Server does not care about the datatypes when making equality comparisons:
    Code:
    declare	@MyFloat1 Float
    declare	@MyFloat2 Float
    declare	@MyInt int
    
    set	@MyFloat1 = 2148.0
    set	@MyFloat2 = 2148
    set	@MyInt = 2148.0
    
    if	(@MyFloat1 = @MyFloat2) and (@MyFloat1 = @MyInt)
    	print 'Works for me!'
    else	print 'Crash and burn.'
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •