Query multiple fields in same table.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • peterbata
    New Member
    • Nov 2011
    • 2

    Query multiple fields in same table.

    Table looks like this:

    Code:
    custno custname qty active banner
    My simple query so far looks like this:

    Code:
    /****** Script for SelectTopNRows command from SSMS  ******/
    SELECT ALL[custno]
          ,[custname]
          ,[qty]
          ,[active]
          ,[banner]
      FROM [mydatabase].[dbo].[subscribe]
      WHERE qty > 1 AND active = 1 AND banner = '99'
    I have a total of nine banners eg. 13, 06, 18, etc

    How would I choose to display the results of several banners of my choosing? Thank you in advance. Peter
    Last edited by NeoPa; Nov 18 '11, 12:03 AM. Reason: Added mandatory [CODE] tags for you
  • ck9663
    Recognized Expert Specialist
    • Jun 2007
    • 2878

    #2
    Join the table to itself. Just use a different alias for each.

    Happy Coding!!!


    ~~ CK

    Comment

    • peterbata
      New Member
      • Nov 2011
      • 2

      #3
      Thank you for the prompt reply. Much appreciated. As a noob, all I have to do now is figure out how to implement your suggestion. Have a good one! Peter

      Comment

      Working...