Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2003
    Location
    New York/New Zealand
    Posts
    8

    Unanswered: Query within a query

    Hi, I am having some logic trouble... I think I want to create a Left Join but I am not sure here is my query...

    SELECT Nature.Nature, t.Apr
    FROM Nature LEFT JOIN (SELECT NatureCountPerMonth.ComplaintNumber AS Apr, NatureCountPerMonth.Nature FROM NatureCountPerMonth WHERE Month = 4 AS t) ON Nature.Nature = t.Nature

    But it doesn't work. How do I nest queries within queries? Is it a syntax problem or is this something that can't be done?

    Thanks in advance for any help,

  2. #2
    Join Date
    May 2003
    Posts
    87

    Re: Query within a query

    Can you explain what you want to achieve?

    Did you try this? Does this sql work?

    Code:
    SELECT Nature.Nature, t.Apr
    FROM Nature, 
      (SELECT NatureCountPerMonth.ComplaintNumber AS Apr,
                   NatureCountPerMonth.Nature 
        FROM NatureCountPerMonth WHERE Month = 4) t
    where Nature.Nature = t.Nature;

  3. #3
    Join Date
    Oct 2003
    Location
    New York/New Zealand
    Posts
    8
    Cheers,
    That would be it... I figured you would change the name of a table the same way you change a field. This is what I needed.

    Thanks,

Posting Permissions

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