![]() | ![]() Products ![]() ![]() ![]() ![]() |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB SQL » View Thread |
Messages 1 to 8 of 8 total |
![]() |
Mon, Apr 18 2016 12:04 PM | Permanent Link |
Rolf Frei eicom GmbH | I want to do this SQL but in a Filter Property of a Table component.
SELECT * FROM VideoList WHERE EXISTS (SELECT * FROM ActorVideos WHERE ActorName = 'James Bond' and VideoHash = VideoList.Hash) VideoList is a table with all films. ActorVideos is a table with the actor names and the videos with that actor. Any single video can have multiple Actors. So I want get all records from VideoList where the Actor is part of it. So I tried to set the Filter to: "EXISTS (SELECT * FROM ActorVideos where ActorName = 'Katt Dylan' and VideoHash = VideoList.Hash)" This doesn't work, as it seems there is no way to use a Subselect in the Filter. Any ideas how I cant get my results with a table compontent and Filter instead a Query component? Change it to a query would need some heavy rework of my rountines and I want try to prevent this. |
Tue, Apr 19 2016 2:26 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Rolf
Simple answer is - you can't The only way I've found to do something like this is to apply a "static" filter in a two stage process. 1. Generate a list of IDs for the target table using a query 2. Set a filter like ID IN (generated list) The other way you could cheat is to add an extra column to the VideoList table and use a trigger to populate it with a boolean Roy Lambert |
Tue, Apr 19 2016 7:13 PM | Permanent Link |
Richard Harding Wise Nutrition Coaching | Rolf,
Perhaps a VIEW could do what you want. Create a VIEW joining VideoList and ActorVideo selecting VideoList.*, ActorVideos.ActorName WHERE VideoList.Hash = ActorVideos.VideoHash This should allow you to do the filtering. Richard |
Wed, Apr 20 2016 3:13 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Richard
Nice idea - stored for future use Roy Lambert |
Wed, Apr 20 2016 8:30 AM | Permanent Link |
Adam Brett Orixa Systems | Rolf
Please try using the following: It works fine for me: SELECT * FROM VideoList WHERE VideoList.Hash IN (SELECT VideoHas FROM ActorVideos WHERE ActorName = 'James Bond') Adam -- NOTE: The "SELECT IN (<subselect>)" syntax is very useful. The field(s) returned by the subselect must be the same type(s) as the field(s) in the WHERE. The WHERE can consist of multiple comma-separated fields. |
Wed, Apr 20 2016 8:56 AM | Permanent Link |
Roy Lambert NLH Associates ![]() | Adam
I think you missed the bit where Rolf says he's trying to use it as a table filter ![]() Roy Lambert |
Wed, Apr 20 2016 11:33 PM | Permanent Link |
Rolf Frei eicom GmbH | @Richard Harding
The problem is that the table should be editable, as I must do some updates on it. So a view will not work. I have now done it with a Query, where I than slect the actual record of the Query in the Table component. Some type of Master/Detail, where my master ist the Query and the Detail is the Table. Thanks anyway for all your tips. |
Thu, Apr 21 2016 9:56 AM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. ![]() | Rolf,
<< The problem is that the table should be editable, as I must do some updates on it. So a view will not work. >> Views are editable as long as they obey the rules for generating a sensitive result set. You can see whether a view is updateable or not in the EDB Manager by looking at the Properties/Details area for the view. There you will see a Updateable: Yes/No that indicates this. Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Wednesday, August 14, 2024 at 07:31 PM | Privacy Policy![]() © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? ![]() |