Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. problem in select sql query

problem in select sql query

Scheduled Pinned Locked Moved Database
databasetutorialhelpquestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Shuaib wasif khan
    wrote on last edited by
    #1

    hello sir, i am new to sql and my problem is that how to find records having two selection criteria for example i have a table headname and month Headname month fees exam fee jan 100 tution fee jan 120 water fee feb 100 games fee march 50 now how can i select row having month=jan,feb and calculate the fees according to headname thanks in advance :zzz:

    L J 2 Replies Last reply
    0
    • S Shuaib wasif khan

      hello sir, i am new to sql and my problem is that how to find records having two selection criteria for example i have a table headname and month Headname month fees exam fee jan 100 tution fee jan 120 water fee feb 100 games fee march 50 now how can i select row having month=jan,feb and calculate the fees according to headname thanks in advance :zzz:

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Hi, the WHERE clause supports logic operators AND, OR, NOT as well as parentheses, so you could do things like SELECT ... FROM ... WHERE (field1='jan' OR field1='feb') AND NOT field2=12 ORDER BY ... :)

      Luc Pattyn [Forum Guidelines] [My Articles]


      The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


      S 1 Reply Last reply
      0
      • L Luc Pattyn

        Hi, the WHERE clause supports logic operators AND, OR, NOT as well as parentheses, so you could do things like SELECT ... FROM ... WHERE (field1='jan' OR field1='feb') AND NOT field2=12 ORDER BY ... :)

        Luc Pattyn [Forum Guidelines] [My Articles]


        The quality and detail of your question reflects on the effectiveness of the help you are likely to get. Show formatted code inside PRE tags, and give clear symptoms when describing a problem.


        S Offline
        S Offline
        Shuaib wasif khan
        wrote on last edited by
        #3

        thanks for reply i have done this by select headname,frequency,sum(c1) from feeshead where months in('jan','feb','march')group by headname,frequency

        1 Reply Last reply
        0
        • S Shuaib wasif khan

          hello sir, i am new to sql and my problem is that how to find records having two selection criteria for example i have a table headname and month Headname month fees exam fee jan 100 tution fee jan 120 water fee feb 100 games fee march 50 now how can i select row having month=jan,feb and calculate the fees according to headname thanks in advance :zzz:

          J Offline
          J Offline
          Jondo24shoots
          wrote on last edited by
          #4

          Select SUM(fees) FROM TABLENAME WHERE headname = 'jan' OR 'feb' OR 'march' NOTE: The (fees) in the query is the name of the column and the "TABLENAME" should be replaced with the table you want to perform de query on. NOTE ALSO: that SQL SERver is not case sensitive Jondo

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups