Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2009

    Unanswered: Select query not giving expected output

    I'm working on a application, where I use sql queries to get the datas from a dbase file.

    There are cases where there can be 2 similar rows with the PARENT and ENFANT fields same in E_Ensart table, but the other columns may ahve different datas.

    I use the below query to retrive datas from the database:
     Private Function GetSQLExactMatch(ByVal name As String, ByVal artTbl As String) As String
            Dim sb As StringBuilder = New StringBuilder("")
            sb.Append(" from E_Ensemb e,  ")
            sb.Append("  E_Ensart a ")
            sb.Append(" where a.PARENT = '" & name & "' ")
            sb.Append(" and e.ITEM_NBR = a.ENFANT ")
            sb.Append("   and a.VALIDITE = 'O'")
            Return sb.ToString()
        End Function
    When I use the above query, I get only one line from E_Ensart table instead of 2 lines.
    I think its because I assign the e.ITEM_NBR =a.ENFANT in my query.
    But even if I remove this line, I get only one row picked instead of 2 rows and I also find that the query is running indefinitly and the same line is repeated n number of times...

    Kindly help me to find out where I'm wrong.
    Hoping for suggestions.
    Thanks in advance.

  2. #2
    Join Date
    May 2003
    Maybe there is a generic SQL answer to your problem that someone here can help you with, but be aware that this DB2 forum has nothing to do with dbase. This forum is for the IBM DB2 database product.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  3. #3
    Join Date
    Dec 2007
    Richmond, VA
    Provided Answers: 5
    do you maybe need an AND/OR condition? Parent = ? OR enfant = ?
    Dave Nance

Posting Permissions

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