DA SQL Query Problem
This is the DW query generated by WA as a set of pages. Note_Details.php:
SELECT NoteID, NoteSubjID, NoteSourceFK, Note_AuthorSited_FK, NoteKeywords, NoteTxt, NotePages, NoteDate, NoteMod
FROM Note
WHERE NoteID = ParamNoteID OR ( -1= ParamNoteID2 AND NoteID= ParamSessionNoteID)
the MySQL DB is fully relational, so I wanted to flesh out the details page with information from other tables referenced by the _FK (foreign key) selects so I added some joins:
SELECT Note.NoteID,
Note.NoteSubjID,
Note.NoteSourceFK,
Note.Note_AuthorSited_FK,
Note.NoteKeywords,
Note.NoteTxt,
Note.NotePages,
Note.NoteDate,
Note.NoteMod,
Subject.Subject_TEXT,
Source.Source_Title,
Author.AuthorLN,
Author.AuthorMN,
Author.AuthorFN
FROM Note INNER JOIN Subject ON Note.NoteSubjID = Subject.Subject_ID
INNER JOIN Source ON Note.NoteSourceFK = Source.SourceID
INNER JOIN Author ON Note.Note_AuthorSited_FK = Author.AuthorID
WHERE NoteID = ParamNoteID OR ( -1= ParamNoteID2 AND NoteID= ParamSessionNoteID)
In production, this new query fails and returns No Record. If I strip out all between ParamNote ID > ParamSessionNoteID) and insert an actual record number it still returns No Record.
HOWEVER, the second query works at the database with a record number instead of ParamNote ID > ParamSessionNoteID).
I don't understand what's wrong here.