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 7651555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:32:11+00:00 2026-05-31T11:32:11+00:00

I have a table ‘node’ wich has a column ‘nid’. This id corresponds to

  • 0

I have a table ‘node’ wich has a column ‘nid’. This id corresponds to the column ‘entity_id’ in three other tables. The three tables we’ll call ‘pop’, ‘city’, ‘state’. The ‘city’ and ‘state’ tables have city_value and state_value columns respectively.

Not all ‘city’ and ‘state’ table rows have a corresponding ‘entity_id’ in the ‘pop’ table.

From this I can get two sets of data. Nodes that have and entity_id in the pop table (setA) and those that don’t (setB).

To get setA I do this:

SELECT nid FROM node
  LEFT OUTER JOIN pop
  ON node.nid = pop.entity_id
  WHERE pop.entity_id IS NOT null

I can’t figure out how to delete rows in ‘node’ from setB that have the same city and state as setA.

EDIT: I had m.entity_id in my setA code but it should have been pop.entity_id in the WHERE line.

EDIT: I think I have it.

SELECT DISTINCT setB.nid FROM 

(
    SELECT DISTINCT AA.nid, AA.title, BB.field_dialup_number_city_value, CC.field_dialup_number_state_value FROM 
    (   
        SELECT node.nid, node.title FROM node LEFT OUTER JOIN field_data_field_dialup_number_popcode pop  
        ON node.nid = pop.entity_id WHERE pop.entity_id IS NOT null  
    ) AA
    INNER JOIN field_data_field_dialup_number_city BB ON AA.nid = BB.entity_id 
    INNER JOIN field_data_field_dialup_number_state CC ON AA.nid = CC.entity_id
) setB


INNER JOIN 
(
    SELECT DISTINCT A.nid, A.title, B.field_dialup_number_city_value, C.field_dialup_number_state_value FROM 
    (   
        SELECT node.nid, node.title FROM node LEFT OUTER JOIN field_data_field_dialup_number_popcode pop  
        ON node.nid = pop.entity_id WHERE pop.entity_id IS null  
    ) A
    INNER JOIN field_data_field_dialup_number_city B ON A.nid = B.entity_id 
    INNER JOIN field_data_field_dialup_number_state C ON A.nid = C.entity_id
) setA


ON setA.field_dialup_number_state_value = setB.field_dialup_number_state_value

WHERE setA.field_dialup_number_city_value = setB.field_dialup_number_city_value
  • 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-31T11:32:12+00:00Added an answer on May 31, 2026 at 11:32 am

    You said setA is

    SELECT nid FROM node  
    LEFT OUTER JOIN pop  
    ON node.nid = pop.entity_id  
    WHERE m.entity_id IS NOT null  
    

    setB would be just a JOIN WHERE NULL

    SELECT nid FROM node  
    LEFT OUTER JOIN pop  
    ON node.nid = pop.entity_id  
    WHERE m.entity_id IS null  
    

    If you want setA to connect back to city and state, try this:

    SELECT DISTINCT A.nid FROM
    (
        SELECT nid FROM node LEFT OUTER JOIN pop  
        ON node.nid = pop.entity_id WHERE m.entity_id IS NOT null  
    ) A
    INNER JOIN  city B ON A.nid = B.entity_id 
    INNER JOIN state C ON A.nid = C.entity_id 
    ;
    

    If you want setB to connect back to city and state, try this:

    SELECT DISTINCT A.nid FROM
    (
        SELECT nid FROM node LEFT OUTER JOIN pop  
        ON node.nid = pop.entity_id WHERE m.entity_id IS null  
    ) A
    INNER JOIN  city B ON A.nid = B.entity_id 
    INNER JOIN state C ON A.nid = C.entity_id 
    ;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have table called Direccion other called Cliente each one defined like this public
I have table A in Oracle that has a primary key (id). I need
I have table defined with FlexiGrid. Call to all variables is ok. One column
I have table with this structure ID | Parameter1 | Parameter 2 | Multiplication
I have table field defined as like this approved_at DATETIME YEAR TO SECOND NOT
I have table in my database which has fields of ID,NAME,CONTEXT. I am showing
I have table in an MS Access database that looks like this: ID Symbol
I have table with data 1/1 to 1/20 in one column. I want the
I have table X, and each record in X has many records in Y.
I have table inside a div tab. The table has 40 rows in it

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.