Created
October 13, 2017 21:05
-
-
Save robgcf/601da8bb5fcbe95bd8f62f64aa0bec0f to your computer and use it in GitHub Desktop.
select with a subquery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select p.proposalname, p.proposalid, p.createdDate, u.lname, u.fname, p.clientid, c.clientname, cust.customername, ct.lname + ', ' + ct.fname as contactname, | |
e.eventname, e.eventid, ( | |
select top 1 activityDate | |
from proposalActivity | |
where proposalid = <cfqueryparam value="#arguments.proposalid#" cfsqltype="cf_sql_integer"> | |
and contactid > 0 | |
order by activityDate desc | |
) as activityDate | |
from proposals p | |
etc etc etc | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment