Results 1 to 4 of 4

Thread: SQL question

  1. #1
    Join Date
    May 2004
    Posts
    159

    Unanswered: SQL question

    Can a query be called from an SQL statement? I am converting a query into SQL and the query calls another query. So do I have to rewrite that to call only tables or can I convert it and run the called query from SQL??
    I tried and I get a error 3000 -unknown error
    Thanks

  2. #2
    Join Date
    Jul 2003
    Location
    Michigan
    Posts
    1,941
    Is this what you are looking to do?

    Select q1.Field1, t1.Field2 from (Select field1 from table2) as q1 inner join
    table1 as t1 on q1.field1 = t1.field1
    Inspiration Through Fermentation

  3. #3
    Join Date
    May 2004
    Posts
    159
    Hmm I am not sure if I understand how to use that- I will have to work on that. Thanks!
    I was thinking it might just be easier to run a maketable query in the code and then build my sql off the created table.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    To answer your question a query can use a query, queries or mix of queries & tables as its recordsource. Although you can have perfomance problems in using queries in other queries it can be done.

    Careful table design may eliminate the need for this but soemtimes needs must.

    I have seen some applications which actually used 4 queries ie query 1 fed query 2, which fed query3 which fed query 4, which was used in a form & report. It was messy but it did work. I wouldn't neccesarily want to use it as a regular technique, but y'never know

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •