HELP!!!! SQL nested Right & Inner Join Syntax Prob

Results 1 to 2 of 2

Thread: HELP!!!! SQL nested Right & Inner Join Syntax Prob

  1. #1

    Default HELP!!!! SQL nested Right & Inner Join Syntax Prob

    HI GUYS,<BR><BR>Oh if someone out there could help I would be so greatly appreciative. I am writing an SQL query that will be getting information from 3 tables (1) Appearance (2) docket_disposition and (3) docket_sentence. Appearance is related to other tables by ID number. but if there is no data in docket_disposition and docket_sentence then the record would not show. I need the record to show by APPEARANCE. therefore I wish to use an RIGHT JOIN and If there is any data in the other 2 tables then I want the data to also show as linked by id.<BR>Here is my NESTED STATEMENT. It&#039s not working. Please HELP<BR><BR>-------<BR>sql_appearance = "SELECT distinct(APPEARANCE.DSEQ), DOCKET_SENTENCE.ID, DOCKET_SENTENCE.DKS_DTL, APPEARANCE.DT, APPEARANCE.PT, APPEARANCE.APP_REL_STA, APPEARANCE.ID, DOCKET_DISPOSITION.DKD_DTL FROM APPEARANCE LEFT JOIN ( DOCKET_DISPOSITION INNER JOIN DOCKET_SENTENCE ON APPEARANCE.ID=DOCKET_SENTENCE.ID AND APPEARANCE.DSEQ=DOCKET_SENTENCE.DSEQ AND APPEARANCE.DT=DOCKET_SENTENCE.DT ) ON APPEARANCE.ID=DOCKET_DISPOSITION.ID " &_<BR>"AND APPEARANCE.DSEQ=DOCKET_DISPOSITION.DSEQ " &_<BR>"AND APPEARANCE.DT=DOCKET_DISPOSITION.DT " &_<BR>"AND APPEARANCE.PT=DOCKET_DISPOSITION.PT " &_<BR>"WHERE APPEARANCE.ID = " & id &_<BR>"AND APPEARANCE.PT=DOCKET_DISPOSITION.PT ORDER BY APPEARANCE.DT DESC, DOCKET_DISPOSITION.DKD_DTL"<BR><BR>I&#039m lost in my nesting I was trying to follow the example used in the 4guysfromrolla article on inner joins<BR>I AM LOST . PLEASE HELP<BR><BR>STEPHEN OF NEW YORK

  2. #2

    Default I had better RESTATE MY Question

    hi guys.<BR>i think i better restate my question.<BR>as stated before i wanted to nest some joins according to this 4guysfromrolla article<BR><BR>i have 3 tables (1) Appearance (2) Docket_disposition (3) Docket_Sentence.<BR><BR>the boss wants all records from Appearance table with the query variable to be displayed even if there is no corresponding field in docket disposition or docket_sentence table.<BR><BR>now i would typically just use a right join with Appearance onthe right table. But I have these 2 additional tables disposition_docket and disposition_sentence I don&#039t want my sql query to ignore those records for which there is no corresponding field fk value in disposition docket or disposition sentence. ANYBODY HAVE ANY IDEAS FOR AN SQL STATEMENT or asp coding??<BR><BR>STEPHEN OF NEW YORK :)

Posting Permissions

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