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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:00:49+00:00 2026-06-12T17:00:49+00:00

I have these tables: ‘Users’ id email name last_access 1 luca@gmail.com Luca Pluto 2012-10-05

  • 0

I have these tables:

‘Users’

id  email                name                 last_access
1   luca@gmail.com       Luca Pluto           2012-10-05 17:21:22.0
2   pippo@gmail.com      Irene Pippo          2012-10-05 17:22:25.0

‘Nets_permissions’

user_id         network_id  perm
1               1234        3
1               1235        1
2               1235        3

I’ve written this query:

SELECT u.id, u.name, n.perm
FROM users as u LEFT OUTER JOIN nets_permissions as n
ON u.id = n.user_id
WHERE n.network_id=1234 AND n.perm <> 3

because I want users that already have a permission for network_id (1234) , but also users that don’t have a permission for the network_id. In other words I would have this result query:

2    null    null

because the user Luca Pluto with id=1, for the net 1234, have perm=3 so I want left out. Instead, the user Irene Pippo with id=2 doesn’t have any permission on the 1234 net. So it’s row must have net_id and perm set to null.

My query result is empty. I don’t know why. Without the clause n.perm <> 3 seems to work well, but after also the null value are left out, not only the rws with perm=3.

I’ve also tried in this way:

SELECT u.id, u.name, n.perm FROM users as u LEFT OUTER JOIN 
(select * from nets_permissions WHERE network_id=1234) as n on u.id = n.user_id 
WHERE n.perm <> 3

but it doesn’t work. without the WHERE clause all works. After no. The result query is empty.

How I can resolve this problem? I need that the perm column is a value or null, I can’t remove this column.

  • 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-06-12T17:00:51+00:00Added an answer on June 12, 2026 at 5:00 pm

    The right solution is:

    SELECT u.id, u.name, n.perm FROM users as u LEFT OUTER JOIN 
    (select * from nets_permissions WHERE network_id=1234) as n on u.id = n.user_id 
    WHERE (n.perm <> 3 or n.perm is NULL)
    

    Here Working with NULL Values there is a expanation of the treatment of NULL values in MySQL

    Thank you all for your help!

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

Sidebar

Related Questions

I have these tables: users ----- id INT name VARCHAR(20) email VARCHAR(40) user_fans ----------
I have these tables: USERS: user_ID username password email data_registered POSTS: post_ID user_ID post_title
I have these tables: comments uid id pid pages pid user users id rank
Suppose you have these tables: Table Name: Salesman Fields: S_ID(Primary Key), Name Table Name:
I have these two tables people ============ id, name and answer_sheets ============ id, person_id,
Say I have these tables: people(id, name), cars(person_id, car) and this query: SELECT c.car
So I have these tables: STUDENTS: Student ID - First name - Last name
I have these tables Table 1 tbl1_site [facilityId] [name] Table 2 tbl2_applicant [pvid] [facilityId]
Let's say I have these tables, with these fields: companies : company_id | name
I have these tables CREATE TABLE parent ( id NUMBER(10, 0) NOT NULL, name

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.