intersting sql puzzle

  • Jaiprakash M Bankolli

    SSC Enthusiast

    Points: 125

    Post some more information !!


    Kindest Regards,
    Jaiprakash M Bankolli
    My Blog
    Suggestions for me

  • Jerome.J.N

    Ten Centuries

    Points: 1274

    Y dont u make this into a sci-fi hollywood movie and the money it generates can be used to out source this kinda problems and solve it. 😛

  • RBarryYoung

    SSC Guru

    Points: 143327

    neat.

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • terryj30

    SSCommitted

    Points: 1866

    does not seem to hard, start with create database create table and so on. hehe

    good luck

  • Atif-ullah Sheikh

    SSChampion

    Points: 12495

    Ok... here it is...

    DECLARE @SpName varchar(10)

    SET @SpName = 'Y'

    SELECT DISTINCT ANTI_MISSILE.antim_id,ANTI_MISSILE.anitm_name FROM DEFUSE_CAPABILITY

    INNER JOIN ANTI_MISSILE ON DEFUSE_CAPABILITY.antim_id = ANTI_MISSILE.antim_id

    WHERE DEFUSE_CAPABILITY.antim_id IN

    (

    SELECT antim_id FROM

    (

    SELECT Count(*) AS xcnt ,antim_id FROM DEFUSE_CAPABILITY

    WHERE missile_id IN (SELECT missile_id FROM ALIEN_CAPABILITY INNER JOIN SPECIES ON SPECIES.spcid = ALIEN_CAPABILITY.spcid WHERE SPECIES.spcname = @SPname)

    Group BY antim_id

    ) C1

    WHERE xcnt >= (SELECT Count(*) FROM ALIEN_CAPABILITY INNER JOIN SPECIES ON SPECIES.spcid = ALIEN_CAPABILITY.spcid WHERE SPECIES.spcname = @SPname)

    )

    Atif Sheikh

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

Viewing 5 posts - 16 through 20 (of 20 total)

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