Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 162
  • Last Modified:

How could I write this inner select

Here's the portion of my table that I want to select from:

select id, actor_id, actor_display_name, posted_time, display_name, geo_coords_lat, geo_coords_lon, location_name, posted_day from verizon where posted_day BETWEEN '2014-03-01' and '2014-03-05'

Open in new window


I want that to be my nested query. How do I grab from that inner select a range of geo_coords_lon and geo_coords_lat?

In other words, I want to select from my inner select those rows that are within a given latitude and longitude range.

How?

BTW: I have tried to create a temporary table and while that approach does work, I'm trying to avoid a situation where I'm "writing" anything in that it takes more time than a select statement. I just need that select statement to be limited to the subquery that I've written.

What do you think?
0
brucegust
Asked:
brucegust
  • 2
1 Solution
 
Ray PaseurCommented:
I think the temporary table with ENGINE=MEMORY is almost certainly what you want.

INNER is a term of art in database work; I'm not seeing any applicability here.

How many rows do you expect to get from the query as written?
0
 
brucegustAuthor Commented:
Ray, I went with an earlier suggestion you made as far as inserting directly from a select statement. Worked like a peach!

Thanks!
0
 
Ray PaseurCommented:
Thanks for the points.  I hope you'll take a moment to abstract out a subset of that big table, perhaps every 1000th row, and post a link to it.  If we have some test data to work with, we can give you better solutions that are more on point when we are answering these questions!

All the best, Ray
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now