Android Question sqlite problem

jim0406

New Member
Licensed User
Longtime User
Hi,
I have these tables in my database
emekart,emekartdap,apo

emekart fields= aa,fkp,.......
emekartdap fields= aa (->emekart.aa),dapo,daa
apod fields=emekartaa (->emekart.aa),aadiam,poso

i have the sql query

Code: Copy
Select  dd.*,  b.aa As baa,  b.sposo,  c.dapo As amoibi,  c.aa As caa,  apod.POSO As posop From
  ((emekart dd Inner Join  (Select  emekartdap.aa,  Sum(emekartdap.dapo) As sposo  From
  emekartdap  Group By  emekartdap.aa) as b On dd.aa = b.aa) Left Join  (Select
  *  From  emekartdap  Where  emekartdap.daa = 20) c On caa = dd.aa) Left Join  (Select
  *  From  apod  Where  apod.AADIAM = '999') apod On apod.emekartaa = dd.aa Where
  dd.fkp = '5021007' Order By  dd.aa Desc

with sqlitestudio in windows and emulator the query working without problem.

with sony xperia x10 mini pro i have problem and the error log is

error:android.database.sqlite.SQLiteException: no such column: b.aa: , while compiling: Select dd.*, b.aa As baa, b.sposo, c.dapo As amoibi, c.aa as caa, apod.POSO As posop from ((emekart dd Inner Join (Select emekartdap.aa,Sum(emekartdap.dapo) As sposo From emekartdap Group By emekartdap.aa) as b On b.aa = dd.aa) Left Join (Select * From emekartdap Where emekartdap.daa = 20) c On caa = dd.aa) Left Join (Select * From apod Where apod.AADIAM = '999') apod On apod.emekartaa = dd.aa Where dd.fkp = '5021007' Order By dd.aa Desc

Where am i wrong ?
thanks
 
Whilst Erel may well be correct, the Xperia X10 Mini is a little bit ageing...

I would try and unravel the SQL a bit - take it back to basics and get something working, otherwise it can be a case of having lots of issues and not being able to sort any of them, as you need to resolve a few issues in there as opposed to just one.

Are you able to give more detail on how the tables are related and also what you are trying to achieve with the query. It may well be that for compatibility reasons you need to execute a couple of queries and then aggregate the results.
 
Upvote 0
Back
Top