sql command strange behaviour
От | Guy Deleeuw |
---|---|
Тема | sql command strange behaviour |
Дата | |
Msg-id | 48E9CD06.4030307@eurofer.be обсуждение исходный текст |
Ответы |
Re: sql command strange behaviour
|
Список | pgsql-admin |
Hello the list I have a problem with an sql command and I not understand what is happens. I execute this query and the result is ok : db_stats=# SELECT code, label, typecumul FROM table_f801_cat_period INNER JOIN table_cat_period USING (code) WHERE typecumul = 0 EXCEPT SELECT code_base, label, typecumul FROM (SELECT code_base FROM table_cat_period_tcodes INNER JOIN table_f801_cat_period ON (code_cumul=code)) AS orphan_f801 INNER JOIN table_cat_period ON (code_base=code) ORDER BY code; code | label | typecumul ----------+----------+----------- 20080799 | Jul 2008 | 0 (1 ligne) db_stats=# Now I execute this query that request one column more, the "ind" field., the return of this query is bad. db_stats=# SELECT code, label, typecumul, ind FROM table_f801_cat_period INNER JOIN table_cat_period USING (code) WHERE typecumul = 0 EXCEPT SELECT code_base, label, typecumul, ind FROM (SELECT code_base, ind FROM table_cat_period_tcodes INNER JOIN table_f801_cat_period ON (code_cumul=code) AND (ind=ind)) AS orphan_f801 INNER JOIN table_cat_period ON (code_base=code) ORDER BY ind, code; code | label | typecumul | ind ----------+----------+-----------+----- 20040199 | Jan 2004 | 0 | 0 20040299 | Feb 2004 | 0 | 1 20040399 | Mar 2004 | 0 | 2 20040499 | Apr 2004 | 0 | 4 20040599 | May 2004 | 0 | 5 20040699 | Jun 2004 | 0 | 6 20040799 | Jul 2004 | 0 | 9 20040899 | Aug 2004 | 0 | 10 20040999 | Sep 2004 | 0 | 11 20041099 | Oct 2004 | 0 | 13 20041199 | Nov 2004 | 0 | 14 20041299 | Dec 2004 | 0 | 15 20050199 | Jan 2005 | 0 | 19 20050299 | Feb 2005 | 0 | 20 20050399 | Mar 2005 | 0 | 21 20050499 | Apr 2005 | 0 | 23 20050599 | May 2005 | 0 | 24 20050699 | Jun 2005 | 0 | 25 20050799 | Jul 2005 | 0 | 28 20050899 | Aug 2005 | 0 | 29 20050999 | Sep 2005 | 0 | 30 20051099 | Oct 2005 | 0 | 32 20051199 | Nov 2005 | 0 | 33 20051299 | Dec 2005 | 0 | 34 20060199 | Jan 2006 | 0 | 38 20060299 | Feb 2006 | 0 | 39 20060399 | Mar 2006 | 0 | 40 20060499 | Apr 2006 | 0 | 42 20060599 | May 2006 | 0 | 43 20060699 | Jun 2006 | 0 | 44 20060799 | Jul 2006 | 0 | 47 20060899 | Aug 2006 | 0 | 48 20060999 | Sep 2006 | 0 | 49 20061099 | Oct 2006 | 0 | 51 20061199 | Nov 2006 | 0 | 52 20061299 | Dec 2006 | 0 | 53 20070199 | Jan 2007 | 0 | 57 20070299 | Feb 2007 | 0 | 58 20070399 | Mar 2007 | 0 | 59 20070499 | Apr 2007 | 0 | 61 20070599 | May 2007 | 0 | 62 20070699 | Jun 2007 | 0 | 63 20070799 | Jul 2007 | 0 | 66 20070899 | Aug 2007 | 0 | 67 20070999 | Sep 2007 | 0 | 68 20071099 | Oct 2007 | 0 | 70 20071199 | Nov 2007 | 0 | 71 20071299 | Dec 2007 | 0 | 72 20080199 | Jan 2008 | 0 | 76 20080299 | Feb 2008 | 0 | 77 20080399 | Mar 2008 | 0 | 78 20080499 | Apr 2008 | 0 | 80 20080599 | May 2008 | 0 | 81 20080699 | Jun 2008 | 0 | 82 20080799 | Jul 2008 | 0 | 85 (55 lignes) db_stats=# if anyone have an idea ... Thanks in advance Guy
В списке pgsql-admin по дате отправления: