There you go... it's  not ugly - I think it's light years better than the
union query :)

-----Original Message-----
From: George Abraham [mailto:[EMAIL PROTECTED]
Sent: Thursday, July 07, 2005 4:03 PM
To: CF-Talk
Subject: Re: OT: SQL count of rows from a union query


Ah,
That explains it. I just solved it using an ugly workaround.

SELECT count(*) FROM table1
WHERE ObjectID IN(
      SELECT ObjectID
      FROM table1 t1 INNER JOIN table2 t2 ON t1.thisID = t2.thisID
      UNION
      SELECT ObjectID
      FROM table1 t1 INNER JOIN table3 t3 ON t1.thisID = t3.thisID
)

Thanks all,
George

On 7/7/05, Claude Schneegans <[EMAIL PROTECTED]> wrote:
>  >>
>
> SELECT count(*)
> FROM (
>        SELECT ObjectID
>        FROM table1 t1 INNER JOIN table2 t2 ON t1.thisID = t2.thisID
>        UNION
>        SELECT ObjectID
>        FROM table1 t1 INNER JOIN table3 t3 ON t1.thisID = t3.thisID
> )
>
> AFAIK, one can have a subquery in a WHERE or HAVING clause, but not inside
a FROM.
> How about making two separate queries and add their record count in CF?
>
>
>
> --
> _______________________________________
> REUSE CODE! Use custom tags;
> See http://www.contentbox.com/claude/customtags/tagstore.cfm
> (Please send any spam to this address: [EMAIL PROTECTED])
> Thanks.
>
>
>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:211389
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to