DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2

Thread: Need in advice

  1. #1
    Tsyrulnikov Edward Guest

    Need in advice

    Dear sirs !I need in your advice.Please assist me build the next query:
    to database:
    I have the next 3 table
    1table A char
    A1 float
    2 table B char
    B1 float
    3 table C char
    C1 float
    I want select A from the first table which has the corresponding A1 which
    satisfied next condition :it must take minimal value in expression
    A1-(B1+C1)
    I ve tried towrite something likes
    select min(A1-(B1+C1)) from 1table but it doesnt allows select any char
    please assist me to correct this problem I spent 2 days trying to make this

    Sincerely yours Edward




  2. #2
    Krishna Guest

    Re: Need in advice


    Try the following

    create table T1(A Char(10), A1 float)
    create table T2(B Char(10), B1 float)
    create table T3(C Char(10), C1 float)

    Insert INTO T1 Values('AAAA', 10.94)
    Insert INTO T2 Values('BBBB', 2.98)
    Insert INTO T3 Values('CCCC', 3.51)

    Insert INTO T1 Values('AAAB', 7.09)
    Insert INTO T2 Values('ABBB', 4.09)
    Insert INTO T3 Values('ACCC', 7.98)


    Select A, min(A1-(B1+C1))
    From T1, T2, T3
    group by A


    Krishna Pada Das, MCDBA
    Consultant
    The Power Of Ten
    Australia




    "Tsyrulnikov Edward" <ceu@a-teleport.com> wrote:
    >Dear sirs !I need in your advice.Please assist me build the next query:
    >to database:
    >I have the next 3 table
    >1table A char
    > A1 float
    >2 table B char
    > B1 float
    >3 table C char
    > C1 float
    >I want select A from the first table which has the corresponding A1 which
    >satisfied next condition :it must take minimal value in expression
    >A1-(B1+C1)
    >I ve tried towrite something likes
    >select min(A1-(B1+C1)) from 1table but it doesnt allows select any char
    >please assist me to correct this problem I spent 2 days trying to make this
    >
    >Sincerely yours Edward
    >
    >
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links