Add Join/lookup to sp in sql server

Add Join/lookup to sp in sql server

am 29.11.2004 23:39:32 von jason

How would I integrate a join for the following sql query:

SELECT DateTime, u_CurrentBrokerID, u_name, URLCurrent AS Page, COUNT(*)
AS Hits
FROM UserInquiry
WHERE (CHARINDEX('@catamarans.com', u_name) = 0)
GROUP BY URLCurrent, DateTime, u_CurrentBrokerID, u_name
HAVING (DateTime > CONVERT(DATETIME, '2004-11-01 00:00:00', 102))

Requirement:

I need to lookup the [u_CurrentBrokerID] from the table [Broker] without
messing up the COUNT etc....

Appreciate feedback.

Regards
Jason

ps: Can this statement be simplified

Re: Add Join/lookup to sp in sql server

am 30.11.2004 21:17:52 von jason

I think I cracked it......seems to be returning correct results. Maybe this
can help someone else:

SELECT UserInquiry.DateTime, UserInquiry.u_name, UserInquiry.URLCurrent,
Broker.Broker AS Page, COUNT(*) AS Hits
FROM UserInquiry INNER JOIN
Broker ON Broker.BrokerID =
UserInquiry.u_CurrentBrokerID
WHERE (CHARINDEX('@catamarans.com', UserInquiry.u_name) = 0)
GROUP BY UserInquiry.DateTime, UserInquiry.u_name, UserInquiry.URLCurrent,
Broker.Broker


wrote in message
news:uJ2iHRm1EHA.2568@TK2MSFTNGP11.phx.gbl...
> How would I integrate a join for the following sql query:
>
> SELECT DateTime, u_CurrentBrokerID, u_name, URLCurrent AS Page,
COUNT(*)
> AS Hits
> FROM UserInquiry
> WHERE (CHARINDEX('@catamarans.com', u_name) = 0)
> GROUP BY URLCurrent, DateTime, u_CurrentBrokerID, u_name
> HAVING (DateTime > CONVERT(DATETIME, '2004-11-01 00:00:00', 102))
>
> Requirement:
>
> I need to lookup the [u_CurrentBrokerID] from the table [Broker] without
> messing up the COUNT etc....
>
> Appreciate feedback.
>
> Regards
> Jason
>
> ps: Can this statement be simplified
>
>