Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3333252
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:46:34+00:00 2026-05-17T23:46:34+00:00

heres the situation. I have a table called as maps coordinates the schema is

  • 0

heres the situation. I have a table called as maps coordinates the schema is like below:

map_coordinates:
item | item_id | latitude | longitude

The idea is that this table contains a list of coordinates of different items, they could be a note, a classifieds post, an event etc. I want to be able to set it up so I have a result set as below:

item | name of item | latitude | longitude

Consider that all events, classifieds and notes are in separate tables. How could I be able to set this up as I need to show all the coordinates on a google maps along with the name of the element i.e if its a classifieds – the title of the ad, an event the title of it etc without having to make alot of sql queries.

I have the code to show it on the map – I just need to grab the details as such. Or do I have to redo my database design here?

========================

EDIT

Actually I have a number of tables in my database such as notes, classifieds and events etc. The point is that an item in the maps_coordinates table refers to the type of the element i.e if its a note or event and teh item_id is the actual id of that event. I don’t want to get stuck with using joins here because that would involve alot of tables. Besides I just need to grab basic information as in just the title to help in populating the map so when I hover over the individual markers I don’t have to make an ajax call just to show basic information of the element at the marker.

The other tables have their own definitions but all of them have a similar title field and it is this title field I wish to show in the same tuple as the coordinates. Or should I denormalize my tables here and have a duplicate entry for title sin the map_coordinates?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:46:34+00:00Added an answer on May 17, 2026 at 11:46 pm

    You can do this by creating a view that combines each of the common elements from the separate tables. In your example note, classifieds post, event, etc.

    CREATE VIEW viewCommonElements
    AS
    
    SELECT 
    100      as DataType,
    NoteId   as ElementId,
    NoteName as ElementName
    FROM Notes
    
    UNION
    
    SELECT 
    200                as DataType,
    Classified_Post_Id as ElementId,
    Post_Description   as ElementName
    FROM Classified_Posts
    
    UNION
    
    SELECT 
    300                as DataType,
    EventId            as ElementId,
    EventName          as ElementName
    FROM Events
    

    Simply add a new DataType for each table you have that you want included in your common elements. You can now set up one query that joins to the viewCommonElements view.

    If a new element is created later on just modify the view and add a union select block giving it a unique datatype. You can use the DataType to distinguish the different common elements from each other.

    I’ve used this method several times to harmonize dis-similar but common data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the situation: I have been called upon to work with InstallAnywhere 8,
Situation Say I have the following: a table items a table lists to which
Sorry for the strange title. Here is my situation. I have a table of
I have a situation where I'm using a table per subclass for association. The
Here's the situation: I have a label's text set, immediately followed by a response.redirect()
Here's the situation: we have an Oracle database we need to connect to to
Here's the situation: We have some generic graphics code that we use for one
Here is my situation: I have an application that use a configuration file. The
Here's the situation. I have a webservice (C# 2.0), which consists of (mainly) a
I have a very common situation here. And for years I haven't found if

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.