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 4 of 4
  1. #1
    Abd
    Abd is offline
    New Coder
    Join Date
    Aug 2002
    Location
    Lagos, Nigeria
    Posts
    99
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Using AND in Select Script

    Hi All,

    trying to select some field from a Sybase Database, see below for my piece of code, the select statement is not returning any record if AND is use. How can I resolve this, any help. See code below;

    SELECT * from nitel_bill_payment where sequence_number = " &pcode& " AND bill_number = "&bill&"

    where &pcode& and &bill& are textboxes name

    Thanks

    Abd
    Abdul

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Uh, is there a javascript question here? One of the moderators will move this post for you to the server-side section

    However, what you have seems to be a proper ANSI SQL type statment, although I tend to shy away from all those extra spaces

    SELECT *
    FROM nitel_bill_payments
    WHERE sequence_number="&pcode&" AND bill_number="&bill&"

    Double check your column names too.
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    jkd
    jkd is offline
    Senior Coder jkd's Avatar
    Join Date
    May 2002
    Location
    metro DC
    Posts
    3,163
    Thanks
    1
    Thanked 18 Times in 18 Posts
    I'll move this to the SQL forum.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No idea about the SQL used for Sybase, but if the values you compare against are numbers, thus containing numerical values, why do you have to put &pcode& and &bill& in quotes? Am I correct in assuming that this creates string values?

    I know for sure that MySQL would let you go away unnoticed if you compare number values against string values... but that's not true for all SQL databases.


  •  

    Posting Permissions

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