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

  • Home
  • SEARCH
  • 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 7442329
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:09:31+00:00 2026-05-29T11:09:31+00:00

Table: Unit ID NAME VALUE 1 Kilo 1000 2 Mega 1000000 3 Giga 1000000000

  • 0
Table: Unit
ID NAME  VALUE
1  Kilo  1000
2  Mega  1000000
3  Giga  1000000000

Table: Storage
ID Title   Drive_value DriveUnitID Cache_value CacheUnitID Status_ID error error_unit area
1  Seagate  100         3          400         1           2         1     1          1
2  Scansoft 250         3          80          2           1         1     2          2

Table: manufac
    ID   area 
    1    US
    2    CHINA 

Table: Status
ID   Description 
1    Blah.. Blah
2    Durka Durka

Desired goal is to have a subselect joining three tables
Something like this (below) but this syntax doesnt work

select 
s.title, 
t.description,
x.area,
u1.value * s.cache_value as Cache,
u2.value * s.drive_value as Drive,
u3.value * s.error_value as Error
((u4.value * s.error_value)+(u4.value * s.error_value)) as ErrorHigh
((u5.value * s.error_value)-(u5.value * s.error_value)) as ErrorHigh
from storage s
join status t on t.id = s.status_id
join manufac x on x.id = s.manufac_id 
join unit u1 on s.cache_unit_id = u1.id
join unit u2 on s.drive_unit_id = u2.id
join unit u3 on s.error_unit_id = u3.id
join unit u4 on s.error_unit_id = u4.id
join unit u5 on s.error_unit_id = u5.id
  • 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-29T11:09:32+00:00Added an answer on May 29, 2026 at 11:09 am

    This queries are semantically the same. But remember either you put the table in the join or in the from clause:

    With explicit joins:

    select s.title, t.description,
    u1.value * s.cache_value as Cache,
    u2.value * s.drive_value as Drive
    from storage s
    join status t on t.id = s.status_id
    join unit u1 on s.cache_unit_id = u1.id
    join unit u2 on s.drive_unit_id = u2.id
    

    With implicit joins:

    select s.title, t.description,
    u1.value * s.cache_value as Cache,
    u2.value * s.drive_value as Drive
    from storage s, status t, unit u1, unit u2
    where t.id = s.status_id and s.cache_unit_id = u1.id and s.drive_unit_id = u2.id
    

    The final result is the same for the end user and the DBMS also process both query the same way, so there are no performance increment by using one or the other.

    Edit:

    After the requirements changed this is the query I think you’re looking for:

    select s.title, t.description,
    u1.value * s.cache_value as Cache,
    u2.value * s.drive_value as Drive,
    u3.value * s.error_value as Error,
    u3.value * s.error_value * 2 as ErrorHigh,
    u3.value * s.error_value - u3.value * s.error_value as ErrorLow,
    m.area
    from storage s
    join status t on t.id = s.status_id
    join manufac m on m.id = s.area
    join unit u1 on s.cache_unit_id = u1.id
    join unit u2 on s.drive_unit_id = u2.id
    join unit u3 on s.error_unit_id = u3.id
    

    Example

    Result:

    +----------+-------------+----------+--------------+---------+-----------+----------+-------+
    |  TITLE   | DESCRIPTION |  CACHE   |    DRIVE     |  ERROR  | ERRORHIGH | ERRORLOW | AREA  |
    +----------+-------------+----------+--------------+---------+-----------+----------+-------+
    | Seagate  | Durka Durka |   400000 | 100000000000 |    1000 |      2000 |        0 | US    |
    | Scansoft | Blah.. Blah | 80000000 | 250000000000 | 1000000 |   2000000 |        0 | CHINA |
    +----------+-------------+----------+--------------+---------+-----------+----------+-------+
    
    • Notice in your question there are two columns named ErrorHigh.
    • Math “errors” x + x = 2 * x (where x = u4.value * s.error_value)
    • Probably the worst math error 🙂 x – x = 0 (where x = u5.value * s.error_value)

    So I guess this query is not what you really need, but should be enough to lead you in the right direction. Good luck!

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

Sidebar

Related Questions

Example: Table: Unit ID NAME VALUE 1 Kilo 1000 2 Mega 1000000 3 Giga
Table: UserId, Value, Date. I want to get the UserId, Value for the max(Date)
table { id: long name: string } 1235 Fred 1902 Trever 5123 George 6467
table user: |id|name|employee_priority_id|user_priority_id| table priority: |id|name| As you can see, there are two foreign
table 1(ob): name,address table 2(address): dname,addr I need to update ob.address with address.addr when
I want to get value of <asp:TextBox ID=txtTotalAmount CssClass=classTotalAmount number Columns=8 runat=server></asp:TextBox> from table.
I am using jquery 1.3.2. This is my code: var additionsPricesItems = debitPrice.find('table[name|=Addition_]'); debitPrice
I have a Formula defined as: @Entity @Table(name = MyEntity) @org.hibernate.annotations.Table(appliesTo = MyEntity) public
table data of 2 columns category and subcategory i want to get a collection
**Table A** 1 2 3 4 5 6 **Table B** 2 3 5 How

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.