Results 1 to 1 of 1
- 07-29-2011, 05:09 PM #1
Member
- Join Date
- Jul 2011
- Posts
- 1
- Rep Power
- 0
Need your help to display correct data by date
Hi Everybody,
I want to calculate Total of Quantity and GROUP BY CarID.
My problem quite difficult to me, and currently I don't know how to do, please help to show me the solutions for this.
In my database have some tables: TBL_CAR_TX, TBL_CAR, TBL_PERSON
table: TBL_CAR_TX
------------------
select * from TBL_CAR_TX
where TranDate >= '2011-06-09' and Trandate <= '2011-06-20'
TranID, AccID, CarID, TranDate, Type, Quantity, .....
--------------------------------------------------------
0 2563 BMW 2011-06-09 H -15 (1)
1 2563 BMW 2011-06-20 R 15
2 2563 BMW 2011-06-20 H 20
3 0055 TOY 2011-06-12 H -10 (2)
4 0055 TOY 2011-06-20 R 10
...
(H): Hold, (R): Release
if we change the condition at WHERE stmt:
select * from TBL_CAR_TX
where TranDate >= '2011-06-10' and Trandate <= '2011-06-19'
==> all the record was disappeared ==> I can't calculate because don't display data.
Look at the table TBL_CAR_TX, we can see that a person borrow car 'BMW' from '2011-06-09' and until '2011-06-20' he returned it. So If I do in SQL Server 2008, how can I keep the record (1) & (2) in the range date from '2011-06-10' to '2011-06-19' to calculate. If can not, how can I do it in java programming ? Any suggest.
table TBL_CAR:
MarketID, CarID, Name, Size, ...
---------------------------
GER BMW
JPA TOY
Table TBL_PERSON:
AccID, Name, Age, DOB, ...
-------------------------
2563 Robert
0055 Mike
Thanks you very much for your help
Similar Threads
-
Inserting current date to oracle Date data type
By bartolay13 in forum JDBCReplies: 5Last Post: 02-16-2012, 09:26 AM -
How to display date & time on GUI?
By BluXit in forum New To JavaReplies: 5Last Post: 05-26-2010, 11:33 AM -
In debug a javabean, how check it is giving to other component CORRECT data-DAO/pools
By lse123 in forum JDBCReplies: 22Last Post: 05-01-2010, 10:52 PM -
Display nodes depending on date
By jlund in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 12-18-2009, 11:47 AM -
can we display registry date using java
By synclenovo in forum Advanced JavaReplies: 1Last Post: 03-30-2009, 12:22 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks