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

  • Home
  • SEARCH
  • 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 881417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:15:23+00:00 2026-05-15T12:15:23+00:00

I need to get the nid alone in this query. SELECT count(nid) as total,nid

  • 0

I need to get the nid “alone” in this query.

SELECT count(nid) as total,nid FROM bird_countries b group by nid order by total asc`

Basically I need this to do something like

update table set field=1 where id in (the other query);

Right now, I’m getting the total of nid’s and the nid, but can’t find how to just get the nid values to use them.

An example of what is returning the first query is:

total nid
1     323
1     2645
1     526
2     123

So I just want to get the values 323, 2645, 526. In fact I don’t want to get the 123 as the count for it is 2.
I need to set one field on the table to 1 for the cases in which the count is 1.

UPDATE (second question):
I get a good answer, but now I have an error applying it. My query is

update bird_countries set season="1" where nid in (SELECT nid FROM bird_countries group  by nid HAVING count(*) = 1)

and mysql says “You can’t specify tablet target ‘bird_countries’ for update in FORM clause.”
Well, is there any easy/fast way to do this? I can duplicate the table bird_countries and use it for the update (and drop it later), but there might be a cleaner way. Thanks!

  • 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-15T12:15:24+00:00Added an answer on May 15, 2026 at 12:15 pm

    I think you want the nids that are unique, without duplicates. Try this:

    SELECT nid
    FROM bird_countries
    GROUP BY nid
    HAVING COUNT(*) = 1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this SQL query about getting the 5 events today: SELECT n.nid, n.type,
So I have this sql code in Drupal: $query = db_query('SELECT wpv.nid, n.title, AVG(vote)
i need get protocol(HTTP, FTP, SSMTP, IMAP, ETC) from ip address and port with
I have 4 Tables (listed bellow) and need: get last 10 Chats from Room
I have two combobox. I need get some value from first combobox1 after combobox1
Both work, obviously if you start concatenating you'll need get string in order to
I need get the same type of array that this.form.elements returns, with input names
i have PostsController controller and in this controller i need get all user list.
I am currently using this: $rawsql = SELECT * FROM _erc_foffices n INNER JOIN
is it possible to do this RewriteRule robots.txt dirname(%{DOCUMENT_ROOT})/robots.php [L] i need get parent

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.