DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Thu, 23 Aug 2007 15:22:44 +0530,    posted on: microsoft.public.dotnet.framework        back       

Thread Index
  1    Barry
          2    Brian Gideon
                 3    Barry


Combining Select Queries   
Hi

I am intrested in combining the results of the following 2 select queries 
into one to display data like this
Count1   Date1      Count2  Date2
  10     1/1/2007    6     1/2/2007


SELECT Count(*) as Count1, Str(Month(User.Logged),2) + '-' + 
Str(Day(User.Logged),2) + '-' + Str(Year(User.Logged),4) as Date1
FROM User
INNER JOIN Table3 ON User.UserId = Table3.UserID
INNER JOIN Table1 ON Member.Id = Table1.ID
WHERE User.Logged Between '01/01/2007' AND '10/01/2007'
GROUP BY Month(User.Logged), Day(User.Logged), Year(User.Logged)

SELECT Count(*) as Count2, Str(Month(User.Logged),2) + '-' + 
Str(Day(User.Logged),2) + '-' + Str(Year(User.Logged),4) as Date2
FROM User
INNER JOIN Table3 ON User.UserId = Table3.UserID
INNER JOIN Table2 ON Member.Id = Table2.ID
WHERE User.Logged Between '01/01/2007' AND '10/01/2007'
GROUP BY Month(User.Logged), Day(User.Logged), Year(User.Logged)


Will someone please Help me.

TIA
Barry
Date:Thu, 23 Aug 2007 15:22:44 +0530   Author:  

Re: Combining Select Queries   
On Aug 23, 4:52 am, "Barry"  wrote:

> Hi
>
> I am intrested in combining the results of the following 2 select queries
> into one to display data like this
> Count1   Date1      Count2  Date2
>   10     1/1/2007    6     1/2/2007
>
> SELECT Count(*) as Count1, Str(Month(User.Logged),2) + '-' +
> Str(Day(User.Logged),2) + '-' + Str(Year(User.Logged),4) as Date1
> FROM User
> INNER JOIN Table3 ON User.UserId = Table3.UserID
> INNER JOIN Table1 ON Member.Id = Table1.ID
> WHERE User.Logged Between '01/01/2007' AND '10/01/2007'
> GROUP BY Month(User.Logged), Day(User.Logged), Year(User.Logged)
>
> SELECT Count(*) as Count2, Str(Month(User.Logged),2) + '-' +
> Str(Day(User.Logged),2) + '-' + Str(Year(User.Logged),4) as Date2
> FROM User
> INNER JOIN Table3 ON User.UserId = Table3.UserID
> INNER JOIN Table2 ON Member.Id = Table2.ID
> WHERE User.Logged Between '01/01/2007' AND '10/01/2007'
> GROUP BY Month(User.Logged), Day(User.Logged), Year(User.Logged)
>
> Will someone please Help me.
>
> TIA
> Barry


I'm not sure exactly what you're after.  Won't those queries return
the same thing?  Are you wanting to crosstab the results in some
manner?  How does this related to the .NET Framework?
Date:Thu, 23 Aug 2007 07:50:32 -0700   Author:  

Re: Combining Select Queries   
Hi Brian

What is crosstab??

Indeed this question is not directly related to .NET Framework, but 
developing website or winforms applicatins using Sql Server queries i 
suppose is very much a part of .NET Framework related development, am i 
right ???

Barry


"Brian Gideon"  wrote in message 
news:1187880632.393400.253620@z24g2000prh.googlegroups.com...

> On Aug 23, 4:52 am, "Barry"  wrote:
>> Hi
>>
>> I am intrested in combining the results of the following 2 select queries
>> into one to display data like this
>> Count1   Date1      Count2  Date2
>>   10     1/1/2007    6     1/2/2007
>>
>> SELECT Count(*) as Count1, Str(Month(User.Logged),2) + '-' +
>> Str(Day(User.Logged),2) + '-' + Str(Year(User.Logged),4) as Date1
>> FROM User
>> INNER JOIN Table3 ON User.UserId = Table3.UserID
>> INNER JOIN Table1 ON Member.Id = Table1.ID
>> WHERE User.Logged Between '01/01/2007' AND '10/01/2007'
>> GROUP BY Month(User.Logged), Day(User.Logged), Year(User.Logged)
>>
>> SELECT Count(*) as Count2, Str(Month(User.Logged),2) + '-' +
>> Str(Day(User.Logged),2) + '-' + Str(Year(User.Logged),4) as Date2
>> FROM User
>> INNER JOIN Table3 ON User.UserId = Table3.UserID
>> INNER JOIN Table2 ON Member.Id = Table2.ID
>> WHERE User.Logged Between '01/01/2007' AND '10/01/2007'
>> GROUP BY Month(User.Logged), Day(User.Logged), Year(User.Logged)
>>
>> Will someone please Help me.
>>
>> TIA
>> Barry
>
> I'm not sure exactly what you're after.  Won't those queries return
> the same thing?  Are you wanting to crosstab the results in some
> manner?  How does this related to the .NET Framework?
> 
Date:Thu, 23 Aug 2007 20:26:45 +0530   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us