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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:36:02+00:00 2026-06-13T05:36:02+00:00

Here’s the query as it stands so far: select `formeid`, `name`, ‘m’ as `gender`

  • 0

Here’s the query as it stands so far:

select `formeid`, `name`, 'm' as `gender` from `data_pokemon`
    where `genders` not like '0|_' and `formeid` not in
        (select `formeid` from `dex` where `userid`=@userid and `gender`='m')
union
select `formeid`, `name`, 'f' as `gender` from `data_pokemon`
    where `genders` not like '_|0' and `formeid` not in
        (select `formeid` from `dex` where `userid`=@userid and `gender`='f')
union
select `formeid`, `name`, 'n' as `gender` from `data_pokemon`
    where `genders`='0|0' and `formeid` not in
        (select `formeid` from `dex` where `userid`=@userid and `gender`='n')
order by `formeid`

As you can see, there’s a lot of repetition. Is there any way to simplify this query so there isn’t so much 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-06-13T05:36:03+00:00Added an answer on June 13, 2026 at 5:36 am
    SELECT   p.formeid, p.name,
             CASE
               WHEN p.genders NOT LIKE '0|_' THEN 'm'
               WHEN p.genders NOT LIKE '_|0' THEN 'f'
               WHEN p.genders =        '0|0' THEN 'n'
             END AS gender
    FROM     data_pokemon p LEFT JOIN dex d
          ON p.formeid = d.formeid
         AND d.userid  = @userid
         AND d.gender  = CASE
               WHEN p.genders NOT LIKE '0|_' THEN 'm'
               WHEN p.genders NOT LIKE '_|0' THEN 'f'
               WHEN p.genders =        '0|0' THEN 'n'
             END
    WHERE    d.formeid IS NULL
    ORDER BY p.formeid
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is an object that I'd like to use with ng-repeat, but it's not
Here is the code: create table `team`.`User`( `UserID` bigint NOT NULL AUTO_INCREMENT , `Username`
Here is the script I'm using, copied directly from Google: <script type=text/javascript> var _gaq
Here is my SQL script CREATE TABLE tracks( track_id int NOT NULL AUTO_INCREMENT, account_id
Here is the final result of what my page is(not much fancy stuff yet):
here is my configuration: http://domain.com (obviously fictitious name...) hosted on a server running Apache
Here's an example query: DECLARE @table table (loc varchar(10)) INSERT INTO @table VALUES ('134a'),
Here's a piece of code I copied from http://www.schillmania.com/content/projects/javascript-animation-1/demo/ Very simple JS animation: function
Here's what my table TheTable looks like ColA | ColB | ColC ------+-------+------ abc
Here's a dump of the stats provided my mod_pagespeed from one of my sites.

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.