|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Dear SQL Gurus:
None of us at our company are SQL query writers and have no clue what we are doing and thus my post. If someone could read the requirements and help me with a query I would really appreciate it! I have a database called PPLNET in SQL Server 2000. I need to count the messages sent to and from a user as recorded in two tables. The table names are: 1. allinboundmessages 2. alloutboundmessages Each of these two tables contains the following relevant fields: 1. vehicle_number 2. created_datetime These two tables do not have any current relationship and we cannot change that. So we need to create a report that shows each vehicle, how many inbound messages were received, how many outbound messages were received, and then calculate a percentage showing the difference. Consider that the outbound should be twice what the inbound number of messages is. How would I write such a query? I figured out how to use the BETWEEN and COUNT methods on each the inbound and out in total but not by driver. Again, any help is MUCH appreciated! Sincerely, Joshua |
|
#2
|
||||
|
||||
|
__________________
My blog about OpenSource Databases PDF tutorials about OSS databases, DBMonster ... Please contribute to Open Source Development, fill bug reports!!! Developer Shed eSupport Commented my.ini/my.cnf (PLEASE ADD YOUR OWN CONFIG TRICK) An introduction to database normalization Natural or Surrogate key Custom ordering for your results Correlated and uncorrelated subqueries Don't turn your outer joins into inner joins |
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > Query Assistance |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|