Solved

sqlite3 error no such column: a.ID, Its fine in the SQLite manager

Posted on 2010-09-24
8
1,577 Views
Last Modified: 2012-05-10
I'm just getting round to implementing this code..

create table tmp as select id, desc, startdate as due, price from billsndeposits where (intervaltype = 'once' or interval = 0) union all select a.ID, a.desc, date(a.startdate, '+'||(b.n*a.interval)||' '||a.intervaltype) as due, a.[price] from billsndeposits a inner join util_nums b on date(a.startdate, '+'||(b.n*a.interval)||' '||a.intervaltype) < date('2011-01-01') where not (intervaltype = 'once' or interval = 0) order by due, id;

Gives me an error.

no such column: a.ID

Its fine in the SQLite manager but not on the device.

Any ideas ?
0
Comment
Question by:mindwarpltd
  • 5
  • 3
8 Comments
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33753488
Hi mindwarpltd,

I copied the code above and it ran on my system without the error you specified above, so you may want to double check the structure of billsndeposits includes the ID column expected by the code.

Kevin
0
 
LVL 59

Accepted Solution

by:
Kevin Cross earned 500 total points
ID: 33753502
Ah, I see now, you said it worked for you also in SQLite Manager but not on the device.  I tried this at the command line and it worked, so please clarify what you mean by not on the device.  Is this through a remote application or are you speaking of the command line interface?
0
 

Author Comment

by:mindwarpltd
ID: 33753539
Its on the iphone.

Can we put the word alias in there, isn't what we have short hand ?
0
 

Author Closing Comment

by:mindwarpltd
ID: 33753569
Yes your right the id has changed some how :)

thanks
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33753581
Yes, you can try that by doing "billsndeposits as a" and ensure it is not a case issue by using "a.id" since you didn't get an error on id in the first part of the union.  

However, remember why we used this tmp table was so that the iPhone App would have a simple :

select * from tmp;

Type of query!
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33753602
AH, cool, glad you found that -- but see my last note -- just remember we were setting up a view on the SQLite end so that the app calls would be simpler and perform better from the static table versus having to handle the larger processing associated with building the events out ...

Thanks for the accepted solution by the way.

Best regards and happy coding,

Kevin
0
 

Author Comment

by:mindwarpltd
ID: 33753735
I thought the last solution was...

create billndesposts table and add some data

Create util_ums table and populate

drop tmp table is already exists
populate

and query tmp table.

I think the view was from an earlier attempt ?
0
 
LVL 59

Expert Comment

by:Kevin Cross
ID: 33754558
You have it correct in your last post.  View was incorrect word on my part.  I just wanted to make sure you were querying the tmp table on the iPhone App -- with the error you were getting I was just making sure, you were just running the drop tmp and populate on the database end which it sounds like you understand.

Good deal and good luck!
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Composite queries are used to retrieve the results from joining multiple queries after applying any filters. UNION, INTERSECT, MINUS, and UNION ALL are some of the operators used to get certain desired results.​
Never store passwords in plain text or just their hash: it seems a no-brainier, but there are still plenty of people doing that. I present the why and how on this subject, offering my own real life solution that you can implement right away, bringin…
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now