Jump to content
  • 0

Returning the correct value from another table


Jodie

Question

Hi - I can't work out what I'm doing wrong with this SQL syntax.

This is in a submission page, and I want to present to my user a field from another table based on the item they selected. So if they selected item 6 on the previous page, I want it to return more details about item 6 on the next page. But no matter what I do, the syntax always returns the first value in the other table. Any help would be much appreciated. Thanks

ISNULL((SELECT (Field4) FROM PW_tbl_progitems WHERE progitemid='[@field:progitemid]'),0)

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Hello @Jodie,

Please test the statement with the 'target' keyword.

ISNULL((SELECT (Field4) FROM PW_tbl_progitems WHERE progitemid=target.[@field:progitemid]),0)

According to your description, it looks like you pass the selected value as a parameter. In this case, the syntax should be:
 

SNULL((SELECT (Field4) FROM PW_tbl_progitems WHERE progitemid='[@progitemid]'),0)

 Feel free to update this thread if you have further questions.  

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...