How to use a value from one of the [message #75918] |
Tue, 20 September 2005 11:12  |
Eclipse User |
|
|
|
Originally posted by: ahundal.research.telcordia.com
Hi everyone,
I am new to using BIRT, so maybe the question comes as a naive one.
Can anyone tell me how to use a value from a column of a table ( that i
fetched from the database) to filter data from some other table and
display it? For example, if there are two tables A and B, then after
fetching table A, I want to fetch only those elements from table B that
have the same value as one of the fields of table A.
I would appreciate your help.
Thanks and best regards
Ahsan hundal
|
|
|
|
|
|
|
Re: How to use a value from one of the [message #76059 is a reply to message #76031] |
Tue, 20 September 2005 18:07  |
Eclipse User |
|
|
|
Ahsan
This is an example query that should work with MySQL.
select CustomerTable.customerName, CustomerTable.customerId,
count(TransactionTable.transactionId)
from CustomerTable, TransactionTable
where CustomerTable.customerId = TransactionTable.customerId
and DATE_SUB(CURDATE (), INTERVAL 30 DAY) <= TransactionTable.timeOfCreation
group by CustomerTable.customerId
Jason Weathersby
BIRT PMC
"Ahsan Hundal" <ahundal@research.telcordia.com> wrote in message
news:453b7d904ba78366d7708abe53f0454c$1@www.eclipse.org...
> Sorry for being a bit ambiguous. Let me clarify to you exactly what i want
> to do. The customers table has a list of the customers names and the
> customer ids. Customer Table:
> customerId customerName
>
> Now in the transaction table there is customer id and then transaction
> id alongwith the time it was created.
> Transaction Table:
> transactionId customerId timeOfCreation
>
> So what I have to do is to display the customer name and then with the
> customers name i need to display the number of transactions he made within
> the last day or month. They should be in sync. this should be the HTML
> table
>
> CustomerName #ofTransactions
>
> I hope now things wud be more clear.
> I would appreciate ur help again and thanks for ur responses.
> Best regards
> ahsan
>
|
|
|
Powered by
FUDForum. Page generated in 0.07799 seconds