Results 1 to 6 of 6

Thread: Multiple statement in one Query

  1. #1
    Junior Member
    Join Date
    Oct 2007
    Answers
    28

    Multiple statement in one Query

    Hello friends..! i have two tables table1 ------- s_id | s_name 1001 | a 1002 | b 1003 | c 1004 | d table2 ------- s_id | s_month 1002 | jan-feb 1004 | mar-apl 1003 | jan-feb result wanted : 1. All the records from table1 except that are in table2 by that must be filtered by s_month in table2 for example 1.)suppose one can filter results by mar_apl gets result 1001,1002,1003 from table1 2.) suppose one filter by month jan-feb he gets result 1001,1004 from table 1 tried so far ------------ "select student_form.student_id,student_form.stu_name from student_form left join last_fee on student_form.student_id=last_fee.student_id where (last_fee.student_id is null);" it returns --------- 1001 only :-(


  2. #2
    Junior Member
    Join Date
    Oct 2007
    Answers
    28

    Re: Multiple statement in one Query

    Pls Help its Urgent


  3. #3
    Junior Member
    Join Date
    Oct 2007
    Answers
    28

    Re: Multiple statement in one Query

    Hello Friends i tryed this but it does not work can any one tell me wt's wrong with this..

    "select student_form.student_id,student_form.stu_name from student_form left join last_fee on student_form.student_id=last_fee.student_id where ((last_fee.student_id is null) and (last_fee.months='jan-feb'))"


  4. #4
    Junior Member
    Join Date
    Aug 2010
    Answers
    1

    Re: Multiple statement in one Query

    Hi, could you please help me also in tuninh the query..i couldnt find the start new thread link..so putting my query here.. could u pls tune this query, as it is taking 10 hours to execute.
    select con.row_id from siebel.s_contact con
    inner join siebel.s_org_ext act on con.pr_dept_ou_id = act.row_id
    inner join siebel.s_addr_org ad on act.pr_addr_id = ad.row_id
    inner join siebel.s_bu BU on con.bu_id = BU.row_id
    where ad.country <> BU.name
    and bu.name <> ( select coalesce( par.name, p.name)
    from s_bu bu
    inner join s_party p on bu.par_row_id = p.row_id
    left outer join s_party par on p.par_party_id = par.row_id
    where p.name=ad.country fetch first row only)
    and (con.ASGN_USR_EXCLD_FLG = 'N'or con.ASGN_USR_EXCLD_FLG is null)
    and exists
    (select 1
    from siebel.s_bu bu1, siebel.S_ASGN_GRP_BU so
    where bu1.name = ad.country
    and so.EFF_START_DT < current timestamp
    and so.bu_id = bu1.row_id
    ) for fetch only with ur ;


  5. #5
    Junior Member
    Join Date
    Oct 2007
    Answers
    28

    Re: Multiple statement in one Query

    first go for diagram structure of tables that is defining relation than u got the Query


  6. #6
    Junior Member
    Join Date
    Oct 2007
    Answers
    28

    Re: Multiple statement in one Query

    Dim stmt1 = "select last_fee.student_id from last_fee where (last_fee.months='jan-feb-march') ;" dim stmt2 = "select student_id from student_form ;" dim cmd1 as new odbc.odbccommand(stmt1, module1.con1) dim cmd2 as new odbc.odbccommand(stmt2, module1.con1) dim rs as odbc.odbcdatareader dim rs2 as odbc.odbcdatareader try rs = cmd1.executereader rs2 = cmd2.executereader while rs.read while rs2.read if val(rs2.item(0)) = val(rs.item(0)) then msgbox("record find") else '****************************result wanted me.listbox1.items.add(rs2.item(0)) 'i want this result in a single sql query end if end while end while catch ex as exception end try


  7.  Sponsored Ads
    Ad


     

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact