Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. y this query answer wrong ?

y this query answer wrong ?

Scheduled Pinned Locked Moved Database
databasesaleshelpquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • W Offline
    W Offline
    williamroma
    wrote on last edited by
    #1

    (SORRY FOR MY BAD ENGLISH ) i have these : cust_line (line_num,cust_id). line_contact(contact_period,line_num). i want to know the customer who the customer of the longest period contact i think this is the quest select max(cc),cust_line.line_num from cust_line JOIN ( select SUM(contact_period)as cc , line_num from line_contact group by line_num )As a on cust_line.line_num=a.line_num where cust_line.line_num=A.line_num but it make a wrong results , please help me ty

    A C 2 Replies Last reply
    0
    • W williamroma

      (SORRY FOR MY BAD ENGLISH ) i have these : cust_line (line_num,cust_id). line_contact(contact_period,line_num). i want to know the customer who the customer of the longest period contact i think this is the quest select max(cc),cust_line.line_num from cust_line JOIN ( select SUM(contact_period)as cc , line_num from line_contact group by line_num )As a on cust_line.line_num=a.line_num where cust_line.line_num=A.line_num but it make a wrong results , please help me ty

      A Offline
      A Offline
      AmitGajjar
      wrote on last edited by
      #2

      hi hope below query will work for you,

      select cust_id,max(contact_period) from line_contact,cust_line where line_contact.line_num = cust_line.line_num;

      thanks -amit

      1 Reply Last reply
      0
      • W williamroma

        (SORRY FOR MY BAD ENGLISH ) i have these : cust_line (line_num,cust_id). line_contact(contact_period,line_num). i want to know the customer who the customer of the longest period contact i think this is the quest select max(cc),cust_line.line_num from cust_line JOIN ( select SUM(contact_period)as cc , line_num from line_contact group by line_num )As a on cust_line.line_num=a.line_num where cust_line.line_num=A.line_num but it make a wrong results , please help me ty

        C Offline
        C Offline
        coded007
        wrote on last edited by
        #3

        Please tell us what is the problem exactly your are facing. If you want data according to customerid just you can add customer id to the view.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups