close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

DA SQL Query Problem

Thread began 11/09/2010 6:23 am by rick178787 | Last modified 11/09/2010 12:42 pm by Jason Byrnes | 1093 views | 3 replies |

rick178787

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.

Sign in to reply to this post

Jason ByrnesWebAssist

most likely the issue is with the join.


when using the INNER JOIN type, there mu st be a match on both sides of the join to return a result. If one of the tables does not a record in it to satisfy the join, no result will be returned.

Double check to make sure that there is data to satisfy the join in all of the tables being joined.

Sign in to reply to this post

rick178787

That's it!

Well done. Guess I'll need to rethink that.

Sign in to reply to this post

Jason ByrnesWebAssist

great, glad to hear that sorted it.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...