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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:16:34+00:00 2026-05-18T03:16:34+00:00

If I have the query below which selects a forum board, but the board

  • 0

If I have the query below which selects a forum board, but the board table contains a column mirror_board_id. Is it possible for me to modify a basic select query to where if mirror_board_id > 0 that it will SELECT * FROM board WHERE board_id = mirror_board_id or something. Currently I’m using 2 queries to accomplish this, but that’s a bit query intensive…

SELECT * FROM board WHERE category_id = 7 AND board_id = 0

update

SELECT * FROM board WHERE category_id = 7 AND
                            (
                                    (
                                        mirror_board_id > 0
                                        AND board_id = mirror_board_id
                                    )
                                OR board_id = 0
                            ) AND
                            display = 1 ORDER BY `order` ASC

This is returning the wrong boards in the list, it’s not actually returning the mirror boards, but original boards where mirror_board_id > 0

  • 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-18T03:16:35+00:00Added an answer on May 18, 2026 at 3:16 am

    Logically, it is:

    SELECT * 
    FROM board 
    WHERE (mirror_board_id > 0 and board_id = mirror_board_id) 
        or board_id = 0 
    

    This can be written more succinctly as:

    SELECT * 
    FROM board 
    WHERE board_id = coalesce(mirror_board_id, 0)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a T-SQL query as below which queries a table holding the search
I'm using Sql-Server, and I have the below query which returns all columns that
I have a result from a query like the below, which does not have
In code below I have a query which retrives all of the modules from
Good morning, I have the mysql query below to display the years sales which
I have a user table in my database which contains two columns FirstName and
The dynamica query I have below works but wondering if what I have below
I am trying to condense the below query which could have unlimited options based
I have this page (code below) which contains a series of 5 checkboxes, all
I have a basic mysqli code below where it performs a query to select

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.