Results 1 to 2 of 2

Thread: Strange results

  1. #1
    Join Date
    Jan 2004
    Posts
    17

    Unanswered: Strange results

    I'm using these queries to select all records of a client where TIPO_NF=E or S but it in the first case when i chose the client
    by number it gives me the results but omit the E results, and
    when i do the second querie it gives me a lot of rows with
    clients that does'nt have anything LIKE what i wrote.
    Ps.: when i do searches with only TYPE=E then, i get
    the E results. am i doing something wrong?

    SELECT table.NAME, table.COMPANY, table.COD_CLIENTE, table.MM_YY, Sum(table.QTD), Sum(table.VALUE1), Sum(table.VALUE2), Sum(table.VALUE3), table.TYPE FROM table WHERE ((table.COD_CLIENT='CLIENTNUMBER') AND (((table.TYPE)='E') OR ((table.TYPE)='S') )) GROUP BY table.COD_CLIENT, table.MM_YY;

    SELECT table.NOME_CLIENT, table.COMPANY, table.COD_CLIENT, t1_2003.MM_YY, Sum(table.QTDE), Sum(table.VALUE1), Sum(table.VALUE2), Sum(table.VALUE3), table.TYPE FROM table WHERE ((table.NAME LIKE '%CLIENT NAME%') AND (((TYPE.TYPE)='E')) OR ((table.TYPE)='S')) GROUP BY table.COD_CLIENT, table.MM_YY;


    thanks in advance
    Last edited by watchachi; 02-06-04 at 16:04.

  2. #2
    Join Date
    Jan 2004
    Posts
    17
    I think i worked too much... i'm going crazy...
    the problem that caused the weired errors, is that i
    didn't put all the GROUP BY arguments, i mean
    i muss refer all columms in GROUP BY to the query work correctly.


    SELECT table.NOME_CLIENT, table.COMPANY, table.COD_CLIENT, t1_2003.MM_YY, Sum(table.QTDE), Sum(table.VALUE1), Sum(table.VALUE2), Sum(table.VALUE3), table.TYPE FROM table WHERE ((table.NAME LIKE '%CLIENT NAME%') AND (((TYPE.TYPE)='E')) OR ((table.TYPE)='S')) GROUP BY table.COD_CLIENT, table.MM_YY, table.COMPANY, ......... (and all the other columns here);

Posting Permissions

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