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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:05:00+00:00 2026-06-12T16:05:00+00:00

This is a pretty complex query so i am having difficulties here. If you

  • 0

This is a pretty complex query so i am having difficulties here. If you help me i appreciate it.

select AvgLevel,TotalCount,tblPokedex.PokemonId,Name,Type1,Type2,Hp,tblPokedex.Attack,tblPokedex.Defense,tblPokedex.SpAttack,tblPokedex.SpDefense,tblPokedex.Speed,(Hp+tblPokedex.Attack+tblPokedex.Defense+tblPokedex.SpAttack+tblPokedex.SpDefense+tblPokedex.Speed) as TotalStats 
from tblPokemonStats,tblAvailablePokemons,tblPokedex 
left join tblUsersPokemons on tblPokedex.PokemonId=tblUsersPokemons.PokemonId 
where tblPokemonStats.PokemonId=tblPokedex.PokemonId 
group by tblPokedex.PokemonId,tblPokedex.Name,tblPokedex.Type1,tblPokedex.Type2,tblPokedex.Hp,tblPokedex.Attack,tblPokedex.Defense,tblPokedex.SpAttack,tblPokedex.SpDefense,tblPokedex.Speed,tblPokemonStats.AvgLevel,tblPokemonStats.TotalCount  
order by PokemonId asc

Alright so what i want to do is for example select between top 100 and 150

How can i do that ?

  • 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-12T16:05:01+00:00Added an answer on June 12, 2026 at 4:05 pm

    Here’s one way – tack on a row_number column and filter on that:

    select AvgLevel /*...*/
    from (
        select AvgLevel /*...*/, row_number() over (order by PokemonId) rownum 
        from tblPokemonStats,tblAvailablePokemons,tblPokedex 
        left join tblUsersPokemons on tblPokedex.PokemonId=tblUsersPokemons.PokemonId 
        where tblPokemonStats.PokemonId=tblPokedex.PokemonId 
        group by /* etc ... */
    ) A
    where A.rownum > 100 and A.rownum <= 150
    

    row_number does what it sounds like – it numbers your rows.

    Here’s another possibility – say you want rows X through Y. You can select the TOP Y rows according to your order. Then use that a subquery and select the TOP Y-X according to the opposite order.
    Assuming X = 100 and Y = 150:

    select top 50 *
    from (
        select top 150 PokemonId
        from tblPokemonStats
        order by PokemonId
    ) A
    order by PokemonId desc
    

    As far as performance, I’m not sure which would be better. My gut says that the ORDER BY approach is better for pages near the ‘front’ so to speak, but row_number() would be better for later pages (high X and Y). That’s just a guess though – run some tests and see what works for you.

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

Sidebar

Related Questions

This is a pretty complex MySQL query for me. what i have is a
This is pretty straight forward. EDIT: Updated question and added fourth echo. Here is
This is a pretty odd situation I have here. I have used a piece
I've got a pretty complex query in MySQL that slows down drastically when one
I have a View that is pretty complex. The query pulls data from about
I have this rather complex query that grabs data from three tables, and now
I have a pretty complex Linq statement with multiple joins, but am having a
I'm trying to do a pretty complex query in MySQL ; complex for me,
I've got a fairly complex sql query that I'm pretty sure I can't accomplish
this pretty much is the thing. When in tinymce I press anything that is

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.