If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > Strange results

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-06-04, 11:39
watchachi watchachi is offline
Registered User
 
Join Date: Jan 2004
Posts: 17
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 15:04.
Reply With Quote
  #2 (permalink)  
Old 02-06-04, 15:08
watchachi watchachi is offline
Registered User
 
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);
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On