SQL Query

Results 1 to 2 of 2

Thread: SQL Query

  1. #1
    Join Date
    Dec 1969

    Default SQL Query

    asplID is a variable for fldUserId which is the Primary Key in all 4 tables. <BR><BR>Now this is getting ridiculous! I have rewritten the Querry like so below. All I want is the 4 tables to be linked to table 1 by *IF* each table contains the same USERID as table1. <BR><BR>sSql = "SELECT tblCMInfo1.*, tblCMInfo2.*, tblCMInfo3.*, tblCMInfo4.* " _ <BR>& "FROM tblCMInfo1 LEFT OUTER JOIN tblCMInfo4 ON (tblCMInfo1.fldUserId = tblCMInfo4.fldUserId) LEFT OUTER JOIN " _ <BR>& "tblCMInfo3 ON (tblCMInfo1.fldUserId = tblCMInfo3.fldUserId) LEFT OUTER JOIN tblCMInfo2 ON (tblCMInfo1.fldUserId = tblCMInfo2.fldUserId) WHERE (tblCMInfo1.fldUserId = &#039;" & asplID & "&#039;)" <BR><BR>So this throws an error .. for this 1 record in particular that does not have fldHomePage filled out and was left blank. So ok fine, I play along and enter a Home page url. Bingo the record is displayed as it should. I say to myself, what a bunch of &*^%! <BR>So I immediately delete the value using SQL Enterprise Manager and again I display the .asp page. That same record still shows up!!! Yet a second ago it refused to because the fldHomePage in tblCMInfo2 was blank. <BR><BR>Make sense? :) <BR><BR>Thanks, <BR>Daniel Acuff <BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: SQL Query

    Was it really blank or was it Null? They are not the same thing - a field that will reject Null values will accept empty ones.<BR><BR>I would guess that your problems would probably go away if you allow Nulls in the field definition for fldHomePage

Posting Permissions

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