TechSapphire Friday, 2024-04-19, 4:10 AM
Site menu
Login form
News
Play Games
  • Deep Freeze
  • Ice Slide
  • Gyroball
  • Fat Fish
  • Bush Royal Rampage
  • Main » 2014 » December » 21

    Sub Queries-


    Three basic rules only.

    Where you can place sub query?
    3 places where you can place your sub query:
    SELECT ----- FROM
    FROM   ----- WHERE
    WHERE  ----->

    SELECT ----- FROM
    _____________________
    (sub query can only return single value & no alias to value returned is required)

    Correct:
    _________

    (select max(val) from abc where ---) Ex output: 10
    (select top 1 val from abc where ----) Ex output: abctext

    Wrong:
    _________
    (select val from abc where ----) and result is returning multple rows:

    Ex. ouput of above query:
    val
    ___
    12
    32
    45
    6
    45

    Click here to view complete article

    Category: Database | Views: 4659 | Added by: Admin | Date: 2014-12-21 | Comments (0)

    Categories
    Programming [27]
    Tips for programming
    Security [2]
    Security Tips
    Google [1]
    Use google faster then ever you use
    Project [14]
    HTML [2]
    Electronics [0]
    Data Structure [0]
    Database [16]
    SQL SERVER
    SSRS [1]
    Sql Server Reporting Services
    Copyright MyCorp © 2024