Skip to content

Instantly share code, notes, and snippets.

@robgcf
Created October 13, 2017 21:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robgcf/601da8bb5fcbe95bd8f62f64aa0bec0f to your computer and use it in GitHub Desktop.
Save robgcf/601da8bb5fcbe95bd8f62f64aa0bec0f to your computer and use it in GitHub Desktop.
select with a subquery
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