Help to check correctness a Query

  • I cannot see any code in red. Could you use italics or bold?

    When you mentioned that your view is called more than once, could you include this part of script?

  • This cleans up your script. Not sure if it'll produce what you're looking for. Can you provide the views, tables, sample data and expected output? And look at the bold code, you're using the same source fields for different "AS' names. That can't be right, can it?

    SELECT DISTINCT

    CRSC1.SourceClassInstanceKeyValue AS [TargetSite],

    CC1.FQDN AS [TargetDomainController],

    CRSC1.SourceClassInstanceKeyValue AS [SourceSite],

    CC1.FQDN AS [SourceDomainController],

    CRCO.[Transport Type] AS [TransportType],

    CRCO.[Manual Connection] AS ManualConnection

    FROM [SC_Class_Rel_Connection Object_View] CRCO,

    SC_ComputerDimension_View CD,

    [SC_Class_Rel_Site-Computer_View] CRSC1,

    SC_Class_Computer_View CC1

    WHERE ((CRCO.SourceClassInstanceID = CD.ComputerID) OR (CRCO.TargetClassInstanceID = CD.ComputerID))

    AND CRCO.TargetClassInstanceID = CRSC1.TargetClassInstanceID

    AND CC1.ClassInstanceID = CRSC1.TargetClassInstanceID

    -- You can't be late until you show up.

Viewing 2 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply