Hello, and thanks for the reply.

SELECT *
 from Employees
where IDContractLevel > 4

is not enough, since I actually need to use a field that is created inside the 
SQL statement to create another field. The problem is that it seems that the 
computed fields is not existing yet when it is used for another field.

The example I posted was only a "stupid" example of what I mean, just to 
clarify the situation. Another example would be this:

SELECT TotalInvoice, (SELECT SUM(PaymentValue) FROM Payments WHERE 
Payments.IDInvoice = IDInvoice) AS TotalPaid, TotalPaid = TotalInvoice AS 
FullyPaid FROM Invoices;

Here, I select:
- TotalInvoice the total amount of the invoice
- TotalPaid the total amount paid till now
- FullyPaid a boolean flag indicating if the invoice is paid or not

the problem is that I get an error "No such column: TotalPaid"

Thanks again
Marco

Jay Sprenkle <[EMAIL PROTECTED]> ha scritto:  On 7/17/06, [EMAIL PROTECTED]  
wrote:
>   Hello, everybody
>
> I'm using a SQL clause to get data from the DB, and I need to use "computed" 
> fields to get the value of other fields. A (stupid) example of what I need is 
> this:
>
> SELECT IDContractLevel, IDContractLevel > 4 as IAmBoss, (SELECT * FROM Bosses 
> WHERE Flag = IAmBoss) FROM Employees;
>
> What I get is an error indicating:
>
> "SQLite error 1 - no such column: IAmBoss"

Could you post the definition of the table Employees?

I wasn't sure if you could put boolean expressions in the select
but it appears to work fine:

SQLite version 3.0.8
Enter ".help" for instructions
sqlite> select 1>4;
0
sqlite> select 6>4;
1
sqlite>

sub selects seem to work fine:

sqlite> select (select 2);
2
sqlite>

I suspect you really want something like this?

SELECT *
 from Employees
where IDContractLevel > 4
;



--
SqliteImporter and SqliteReplicator: Command line utilities for Sqlite
http://www.reddawn.net/~jsprenkl/Sqlite

Cthulhu Bucks!
http://www.cthulhubucks.com


 Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 

Reply via email to