mardi 25 mars 2014

the query with start and end date


Vote count:

0




Can somebody help me for a query. I have the table dbo.table. I has writtenthis query:



select Name, Service, number, Dates, Country, Price
from dbo.table
where country is not NULL and Service in ('Incoming', 'Outgoing') and years =2014 and months=3


I am getting the results:



User1 Incoming 1111 03.07.2014 Belarus 5,5
User1 Incoming 1111 03.09.2014 Belarus 1,5
User1 Incoming 1111 03.10.2014 Belarus 1,5
User1 Outgoing 1111 03.10.2014 Belarus 2
User1 Outgoing 1111 03.11.2014 Belarus 3
User1 Outgoing 1111 03.11.2014 Belarus 4
User1 Incoming 1111 03.07.2014 France 4,3
User1 Incoming 1111 03.07.2014 France 2,7
User1 Incoming 1111 03.08.2014 France 1
User1 Outgoing 1111 03.15.2014 France 2
User1 Outgoing 1111 03.15.2014 France 3
User1 Outgoing 1111 03.15.2014 France 6


What should I use the query that if want get this result:



User1 Incoming 03.07.2014 03.10.2014 Belarus 8,5
User1 Outgoing 03.10.2014 03.11.2014 Belarus 9
User1 Incoming 03.07.2014 03.08.2014 France 8
User1 Outgoing 03.15.2014 03.15.2014 France 11


asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire