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 the below query, which basically it retrieves the 5 top most books
I have a sql server query question. I have a table like below. Giving
I have this query in sql server 2000: select pwdencrypt('AAAA') which outputs an encrypted
I want to group the below query by GetSetDomainName and select the row which
I have an sql query which calculates the number of distinct fileIds in a
I've noticed that a few Wordpress blogs have query statistics present in their footer
I have a query where I wish to retrieve the oldest X records. At
I have a query that is dynamically built after looking up a field list
I have a query that originally looks like this: select c.Id, c.Name, c.CountryCode, c.CustomerNumber,
I have a query that looks like this: public IList<Post> FetchLatestOrders(int pageIndex, int recordCount)

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.