hi newsgroup

I stumbled upon a strange select behavior. maybe somebody here can
help me.

I have the following select statement

programms = db(
   (db.TBLsoftware.id==db.TBLsoftware_to_programms.TBLsoftware) &
   (db.TBLprogramms.id==db.TBLsoftware_to_programms.TBLprogramms) &
   (db.TBLsoftware.id == softwareID) &
   (db.TBLprogramms.Hash != db.TBLfilter_software_hidden.hash)
).select(
  db.TBLprogramms.Name,
  db.TBLprogramms.Name2,
  db.TBLprogramms.Hash,
  db.TBLprogramms.InstallDate,
  db.TBLprogramms.Version,
  orderby=~db.TBLprogramms.InstallDate,
  distinct=True
)

as you can see I join some tables (TBLsoftware,
TBLsoftware_to_programms, TBLprogramms) to get some values from
TBLprogramms and filter them (db.TBLprogramms.Hash !=
db.TBLfilter_software_hidden.hash) with a hash.

using _select and print I get the following sql statement
SELECT DISTINCT
  TBLprogramms.Name,
  TBLprogramms.Name2,
  TBLprogramms.Hash,
  TBLprogramms.InstallDate,
  TBLprogramms.Version
FROM
  TBLsoftware_to_programms,
  TBLprogramms, TBLsoftware,
  TBLfilter_software_hidden
WHERE
(
 (
  (
   (TBLsoftware.id = TBLsoftware_to_programms.TBLsoftware)
   AND
   (TBLprogramms.id = TBLsoftware_to_programms.TBLprogramms)
  )
AND
(TBLsoftware.id = 74)
)
AND
(TBLprogramms.Hash <> TBLfilter_software_hidden.hash)
)
ORDER BY TBLprogramms.InstallDate DESC;

however if I select the hashes from TBLfilter_software_hidden.hash
seperatly and compare the hashes from programms I still get hash that
should not be in the result.

hidden_filter =
db().select(db.TBLfilter_software_hidden.hash).as_list()
hidden_filter_list = []
for element in hidden_filter:
  hidden_filter_list.append(element['hash'])

for programm in programms:
 if programm['Hash'] in hidden_filter_list:
  print programm['Name'] + " " + programm['Hash']

did I miss something or is there some kind of error in my initial
select statement?


with regards
Christian Degenkolb



Reply via email to