SQL查询涉及子查询

时间:2015-09-04 16:46:56

标签: sql oracle

我想写一个查询来查找相应的西经度值,其中北纬度的最大值小于137.2345,最多4位小数。我写了以下查询

SELECT TO_CHAR(LONG_W,'999.9999') 
FROM STATION WHERE LAT_N =(SELECT TO_CHAR(MAX(LAT_N),'999.9999')
FROM STATION WHERE LAT_N<'137.2345');

我没有得到输出,请指导我!

1 个答案:

答案 0 :(得分:0)

我很难跟上这个问题。此查询将为您提供最大lat_n的LONG_W&lt; 137.2345

class User < ActiveRecord::Base
end

class Ingredient < ActiveRecord::Base
end

class Unit < ActiveRecord::Base
end

class Recipe < ActiveRecord::Base
    has_many :recipe_ingredients
    accepts_nested_attributes_for   :recipe_ingredients
end

class RecipeIngredient < ActiveRecord::Base
  belongs_to :recipe
  belongs_to :ingredient
end