Hello, I have a single table and I'm trying to select some data out of a subset of that data. For example, something like: SELECT * FROM (SELECT * FROM Table WHERE ....) WHERE....... It is being done on a single table and should return several results (not the single result that i believe a subquery returns) Does anyone know a way of doing this?
ok but theres one more complication, I have to run a complicated string function check as the condition on the subset If this condition is run on the whole table, it results in an "invalid procedure call error" That's why I have to run it on just a subset of the main table. If the condition is run on the subset, it will return all the correct records. So if i do it this way: SELECT * FROM (SELECT * FROM table WHERE ..condition to extract the subset..) WHERE (string condition) it gives that error because its not applying the string condition just to the subset, but to the whole table where the string condition can't apply.. If i do: SELECT * FROM (SELECT * FROM Table WHERE...condition to extract the subset....AND string condition) it also gives an error because the string condition is still being applied to the whole table. I need to extract the subset, keep it in isolation, then perform the string function upon it....
You could try using a self join. You could also try something like: SELECT * FROM my_table WHERE id_column IN ( SELECT id_column FROM my_table WHERE condition... )
why not try self join? please share data structure and sample data with desired output and conditions to help us build a query for you..
Why twice selecting on one table ? If it is possible Write down the structure and let us know what do you want data do you want to collect ?