|
Posted by Bob Bedford on 11/27/10 11:27
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, t.name, 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 = F.id
INNER JOIN t as B on t.idb = B.id
WHERE mk.id = 'A12D'
AND (m.ID = 15)
AND (200001 >= dst AND (den = '' or 199905 <= den))
AND F.l = 'b'
AND B.l = 'b')
UNION
(SELECT st.code, st.name, COALESCE(m.Name, sm.Name), st.idb, st.ids, st.prt,
F.t, st.puiss, B.t, stdst, stden
FROM st
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 = F.id
LEFT JOIN t as B on st.idb = B.id
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.
Bob
[Back to original message]
|