mysql problem

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have no access to any Mysql Newsgroup, so I ask here.

I've the same query executed many times and sometimes it returns all results  
(117 in my case) and sometimes it returns nothing.
THE QUERY DOESN'T CHANGE, nor the datas in the database.

On my pc it's OK (always returns 117 results) even on phpmyadmin it returns  
the 117 records found.
On my ISP, the result is always 0 results, even if it shows 117 results.
Here is the query (I know, not so simple, but I took an existing database)

(SELECT Code,, m.Name, t.idb,t.ids, prt , F.t, puiss, B.t, dst, den
from t INNER JOIN m ON t.idm = m.idm
INNER JOIN mk ON m.idmk = mk.idmk
INNER JOIN t as F ON t.idf =
INNER JOIN t as B on t.idb =
WHERE = 'A12D'
AND (m.ID = 15)
AND (200001 >= dst AND (den = '' or 199905 <= den))
AND F.l = 'b'
AND B.l = 'b')
(SELECT st.code,, COALESCE(m.Name, sm.Name), st.idb, st.ids, st.prt,  
F.t, st.puiss, B.t, stdst, stden
LEFT JOIN sm ON st.idm = sm.idm
LEFT JOIN m ON st.idm = m.idm
LEFT JOIN smk ON sm.idsmk = smk.idsmk
LEFT JOIN mk ON m.idmk = mk.idmk
LEFT JOIN mk AS mk1 ON sm.idmk = mk1.idmk
LEFT JOIN t as F ON st.idf =
LEFT JOIN t as B on st.idb =
WHERE (m.ID = 15 or st.ID = 15 or sm.ID = 15)
AND ((stdst is null or '2000-01-01' >= stdst) AND (sten is null or '199905'  
 >= sten))
AND F.l = 'b' AND B.l = 'b')

Any idea why sometimes I get all results, other nothing.
Changing the query for having results in the second select (after the  
UNION), I get sometimes only the result of the 2nd part instead
So sometimes I get the results from the first part, sometimes not. From the  
second part I aways get results.


Re: mysql problem

Forget about the looooong query. I've simplified it in order to eliminate  
all possible error source.

Here is the simplest query that fails sometimes:

FROM type
INNER JOIN mod ON type.modcode = mod.modcode
INNER JOIN mak ON mod.makecode = mak.makecode

this query works
FROM type
INNER JOIN mod ON type.modcode = mod.modcode

So it seems that as soon as you put 2 inner joins with a table named "type"  
then it fails: sometimes I get records, sometimes not.
with query results, the result count is 0-0 (1 total) (in phpmyadmin)

any idea ?

Site Timeline