Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Query help

Author  Topic 

gxs8938
Starting Member

23 Posts

Posted - 2010-07-30 : 16:40:44
Hi all ,

I have this query below
WITH tempLog AS (SELECT email,viewdate,userid from invitation where threadid=666) SELECT distinct firstname+' ' +lastname as invitee,templog.viewdate as dateandtime FROM tempLog,Users WHERE Users.email=templog.email

which gives me invitee names and date, but my issue here is if I send an invite to an random user who is not present in the system it will not show up because the firstname and lastname will not be found.

So how to change this query to show up just email address if the firstname and username does not exists.

Any help will be appreciated.

Regards,
Guru

gxs8938
Starting Member

23 Posts

Posted - 2010-07-30 : 21:12:48
Below is what i have so far,but it still does not work.. somehow i need to get the union of users and invitation email.. any help

with details as(
SELECT firstname+' '+lastname as invitee,email from users
),
email as(select email from invitation
where threadid=666)

select isnull(a.invitee,b.email) result from details a,email b
where a.email=b.email
Go to Top of Page

waterduck
Aged Yak Warrior

982 Posts

Posted - 2010-07-31 : 07:02:09
hi, this might silly...
try to do this in front end, if nothing return after search (row=0) just show that email.


Hope can help...but advise to wait pros with confirmation...
Go to Top of Page
   

- Advertisement -