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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:06:38+00:00 2026-05-19T15:06:38+00:00

I have an MySQL Query looks like that: SELECT client.id, client.vorname, client.nachname, DATE_FORMAT(geburtsDatum, ‘%d.%m.%Y’),

  • 0

I have an MySQL Query looks like that:

SELECT
  client.id, client.vorname, client.nachname, DATE_FORMAT(geburtsDatum, '%d.%m.%Y'), zahlung.zuUebBet, zahlung.betrag
FROM
  zahlung JOIN client ON ( zahlung.mitgliedsNr = client.id )
WHERE
  client.typ = 'U'
OR
  client.typ is null
AND
  zahlung.typ = 'Beitrag'
AND
  anBGueberwiesen = '0000-00-00'
AND
  zahlung.zuUebBet IS NOT NULL
AND 
  (
    zahlung.vomBGeinheb = 0
  OR
    zahlung.vomBGeinheb is null
  )

All work fine but the case:

zahlung.zuUebBet IS NOT NULL

looks like beeing ignored. (I get rows with lots of NULL in it)

Anyone know whats going on?

  • 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-19T15:06:39+00:00Added an answer on May 19, 2026 at 3:06 pm

    please take a look at the operator precedence of mysql. OR has a lower precedence than AND, so you’ll have to put this into braces to get the desired result:

      client.typ = 'U'
    OR
      client.typ is null
    

    the complete WHERE-block should look like this:

      (
        client.typ = 'U'
      OR
        client.typ is null
      )
    AND
      zahlung.typ = 'Beitrag'
    AND
      anBGueberwiesen = '0000-00-00'
    AND
      zahlung.zuUebBet IS NOT NULL
    AND 
      (
        zahlung.vomBGeinheb = 0
      OR
        zahlung.vomBGeinheb is null
      )
    

    otherwise, the sql-statement would be treated like the following (wich isn’t what you wanted, i think) (i’ve added braces to make things clear):

      client.typ = 'U'
    OR
      (
        client.typ is null
      AND
        zahlung.typ = 'Beitrag'
      AND
        anBGueberwiesen = '0000-00-00'
      AND
        zahlung.zuUebBet IS NOT NULL
      AND 
        (
          zahlung.vomBGeinheb = 0
        OR
          zahlung.vomBGeinheb is null
        )
      )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple MySQL query that looks something like this SELECT * FROM
I have a query that looks like this: select id , int1 , int2
I have a simple query that looks like select id, name from mytable where
I have a mysql problem, my query looks as follows but not complete SELECT
I have a mysql query Select * from tbl_schoolphotos where Filename like 'glasshouse_1_%' order
I have a MySQL query that I would like to optimize a little bit.
I have a MySQL query like this: SELECT DAYNAME(CreatedAt) AS TheDay, SUM(Amount) AS TheSum
I have a query that looks like this: $sql = UPDATE tbl SET amt_field='amt_field+1'
I have a MySQL table that looks like this: id (int primary) name (text)
I have a nhibernate linq query that looks like this: from b in session.Query<Bookmark>()

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.