Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Sep 2006
    Location
    Pakistan
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Select statment in ASP

    i want to fetch records in ASP via select statement to show the data of having value 0 or 2, i used

    SQLPOP3="select schoolid from univall where schoolname like '%"&stname&"%' and tehsilcode='"&Tehcode&"' and distcode='"&DistCode&"' and water <>1"
    or
    SQLPOP3="select schoolid from univall where schoolname like '%"&stname&"%' and tehsilcode='"&Tehcode&"' and distcode='"&DistCode&"' and water =0 and water = 2"
    but its not working, i want to get records have water value 0 or 2
    someone can help me
    thanks

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Posts
    120
    Thanks
    0
    Thanked 3 Times in 3 Posts
    Try
    select * from univall where (univall =0 or univall =2)

    HTH, Tom

  • #3
    New Coder
    Join Date
    Sep 2006
    Location
    Pakistan
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I used this again but still not working
    SQLPOPdistrict="select schoolid from univall where tehsilcode='"&Tehcode&"' and distcode='"&DistCode&"' and (electricity=2 or electricity=0)"

  • #4
    New Coder
    Join Date
    Sep 2006
    Location
    Pakistan
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i have done now thanks for you

  • #5
    New Coder
    Join Date
    Sep 2006
    Location
    Pakistan
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts
    now i need to handle null values in data field how to use select statment
    SQLPOPdistrict="select schoolid from univall where tehsilcode='"&Tehcode&"' and distcode='"&DistCode&"' and (electricity=2 or electricity=0 and electricity =null)"

  • #6
    Senior Coder
    Join Date
    Jun 2002
    Location
    Zwolle, The Netherlands
    Posts
    1,120
    Thanks
    2
    Thanked 31 Times in 31 Posts
    SQLPOPdistrict="select schoolid from univall where tehsilcode='"&Tehcode&"' and distcode='"&DistCode&"' and electricity in (2, 0, null)"
    I am the luckiest man in the world


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •