Reg -Joins

  • Hi Friends,

    I have two table like

    table A

    IDTESTIDSTATUS CREATE DATEUPDATE DATE

    1100 Open 2013-05-08 16:13:20.4532013-05-08 16:13:20.453

    1101 PendForReview2013-05-08 16:13:20.4532013-05-10 13:09:23.523

    1102 Open 2013-05-08 16:13:20.4532013-05-10 13:17:06.340

    1103 OpenRequest2013-05-08 16:13:20.4532013-05-10 13:18:05.197

    1104 Closed 2013-05-08 16:13:20.4532013-05-10 16:45:14.077

    table b

    IDMAPIDSTATUS CREATE DATE UPDATE DATE

    1NULL OPEN 2013-05-08 16:13:20.5372013-05-08 16:13:20.537

    122737 NULL 2013-05-08 16:29:32.7472013-05-08 16:29:32.747

    1637 CLOSED 2013-05-10 13:09:23.7502013-05-10 13:09:23.750

    1637 PendForReview 2013-05-10 13:17:06.5202013-05-10 13:17:06.520

    117837 OPEN 2013-05-10 13:18:05.3372013-05-10 13:18:05.337

    122737CLOSED 2013-05-10 16:45:14.4202013-05-10 16:45:14.420

    114037 NULL 2013-05-10 19:50:21.0872013-05-10 19:50:21.087

    1837 OPEN 2013-05-10 19:55:41.1632013-05-10 19:55:41.163

    i want mapid for TABLE A FROM TABLE B. I have use join but i am getting Cartesian product. How can i do this

    result like:

    id,test id ,status,mapid

  • If you are using ID for the join you will get a Cartesian result.

    How do you know which row in table b belongs to each row in table a?

    Far away is close at hand in the images of elsewhere.
    Anon.

  • I don't see anything (in common between the two) in that sample data that could help prevent the Cartesian product except maybe the dates.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

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

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