Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL Statement Help!!!

Status
Not open for further replies.

bmann

Programmer
Oct 8, 2002
128
US
What is wrong with this SQL statement. I get this error Invalid object name 'FN.Max'. I would appreciate someone help.

select *FROM LAcalphoto.DOJviews.dbo.DOB N
LEFT JOIN Los_Angeles_CALPHOTO.dbo.DOB_FULL FN on N.timestamp > FN.Max(timestamp)
 
FN can identify a function, it looks to me like it is trying to run a function named max with the input of timestamp. Try changing both FN's to just F.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
You're doing the join on a function not a field so as written it wont work. Here's what you need to do

Select n.* From lacalphoto.dojviews.dbo.dob n Left Join (Select Max(timestamp) as param From los_angeles_calphoto.dbo.dob_full) FN on n.timestamp > fn.param

 
Try something like that (depending on your purpose):

Code:
select * FROM LAcalphoto.DOJviews.dbo.DOB 
where timestamp > (select Max(timestamp) from Los_Angeles_CALPHOTO.dbo.DOB_FULL)

or

Code:
select * FROM LAcalphoto.DOJviews.dbo.DOB N
LEFT JOIN Los_Angeles_CALPHOTO.dbo.DOB_FULL FN 
on N.timestamp > (select Max(timestamp) from Los_Angeles_CALPHOTO.dbo.DOB_FULL)

I hope this help.



Imobiliárias em Suzano
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top