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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:21:18+00:00 2026-06-02T22:21:18+00:00

TableBoxes TableItems BoxCode BoxDesc ItemNo BoxCode ItemDesc X1 Freight1 123 X1 Tomatoes X4 Freight2

  • 0
    TableBoxes                          TableItems
 BoxCode    BoxDesc                   ItemNo    BoxCode       ItemDesc
    X1        Freight1                   123       X1            Tomatoes
    X4        Freight2                   124       X1            Apples  
    X8        Freight3                   128       X4            Potatoes   

I want result row for BoxCode=X1 only, with output ordered by ItemNo

BoxNumber         ItemNo               ItemDesc
   1                1                     Tomatoes
   1                2                     Apples

I can easily get the ‘ItemNo’ serial working by using row_number() on ItemNo. How do I find the serial of the box from the first table ?
My current query

select 
    row_number() over(
          order by a.ItemNo
    )as ItemNo
    ,ItemDesc
from 
    TableItems a 
    inner join TableBoxes b 
        on a.BoxCode=b.BoxCode 
where
    a.BoxCode='X1'

Can’t figure out how to select serial for BoxCode, Damien.

  • 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-02T22:21:27+00:00Added an answer on June 2, 2026 at 10:21 pm

    Is this what you want?

    WITH TableBoxesRanked AS (
      SELECT
        *,
        BoxNumber = ROW_NUMBER() OVER (ORDER BY BoxCode)
      FROM TableBoxes
    )
    SELECT
      b.BoxNumber,
      ItemNumber = ROW_NUMBER() OVER (ORDER BY i.ItemNo),
      i.ItemDesc
    FROM TableItems i
      INNER JOIN TableBoxesRanked b ON i.BoxCode = b.BoxCode
    WHERE a.BoxCode = 'X1'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create table using sql developer create table tablenodes ( nodeNo int , nodeName
I've 2 classes. One is a linq-to-sql class and the other is a seriazable
Here's my problem I have this javascript if (exchRate != ) { function roundthecon()
I have this response.write on my page function roundthecon() { document.write(Math.round(exchRate*Math.pow(10,2))/Math.pow(10,2)); } But it
I'm trying to create cascading DDLs. My aspx page: <form id=form1 runat=server> <table> <tr>
Imagine the following tables: create table boxes( id int, name text, ...); create table
I'm trying to create an interface with three tabboxes where the user can choose
I would like each click is associated with the right occurrence in the table
I'm trying to understand block container boxes as described in the CSS2.1 spec, but
I want to try to create a learning chess application as a school project.

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.