Results 1 to 7 of 7

Thread: sql

  1. #1
    Join Date
    Jul 2012
    Posts
    2

    Unanswered: sql

    am having 4 tables depositnew,customernew,branchnew,borrownew
    columns in depositnew-actno,cname,amt,date
    columns in branchnew-bname,city
    columns in customernew-cname,city
    columns in borrownew-loanno,cname,bname,amt
    i want the details of anil,whose details are in all the four tables..how to find ??

  2. #2
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Thumbs down

    Quote Originally Posted by PRAV01 View Post
    ...
    i want the details of anil,whose details are in all the four tables..how to find ??
    By coding an adequate SQL query statement.
    Try doing your own homework.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  3. #3
    Join Date
    Jul 2012
    Posts
    2

    sql

    anil's details which i want in result

    actno,bname,amt,adate(from depositnew table),cname&city(from branchnew table),city(from customernew table),loanno&amt(from borrownew table)

  4. #4
    Join Date
    Aug 2003
    Location
    Where the Surf Meets the Turf @Del Mar, CA
    Posts
    7,776
    Provided Answers: 1
    anil does not exist in any of my tables.
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  5. #5
    Join Date
    Jan 2004
    Location
    Croatia, Europe
    Posts
    4,094
    Provided Answers: 4
    JOIN is what you are looking for, I suppose. As there are 4 tables, at least 3 conditions should be used in the WHERE clause. For example:
    Code:
    select 
      d.actno, 
      b.bname,
      c.cname,
      r.loanno
    from depositnew d,
         branchnew b,
         customernew c,
         borrownew r
    where b.city = c.city
      and c.cname = r.cname
      and r.cname = d.cname
      and d.cname = 'ANIL';
    I don't know whether these tables are correctly joined (as you didn't provide that information), but I hope you'll get the idea.

  6. #6
    Join Date
    Jul 2012
    Posts
    9

    Smile sql

    columns in depositnew-actno,cname,amt,date
    .
    .
    .
    it does not accept "date" as a column name

  7. #7
    Join Date
    Jul 2012
    Posts
    9
    select
    d.actno, d.cname, d.amt, d.d_date,
    b.bname, b.city,
    bw.loanno
    from
    depositnew d ,
    branchnew b,
    customernew c,
    borrownew bw
    where d.cname='anil' and d.cname=c.cname and c.cname=bw.cname and b.city=c.city
    Last edited by NARESHSHREERAM; 07-22-12 at 05:29. Reason: here you must take care of case and auto generate from one table to another table and constraints..then it will be easy

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •