0

This is my current statement. It does not work. It returns 0 results.

SELECT ID,ACCOUNT,Key,MasterKey, key FROM Asset 
    WHERE  MasterKey = $parent_key And Asset = $asset

If I change this statement to hardcoded values:

SELECT ID,ACCOUNT,Key,MasterKey, key FROM Asset 
    WHERE  MasterKey = '1234' And Asset = 'Test'

It works.

The variables are being filled using an IBM tool, Castiron. I'm not sure if I need to consult that group, or just simply add the single quotes around the variable values.

Something like this:

SELECT ID,ACCOUNT,Key,MasterKey, key FROM Asset 
    WHERE  MasterKey = '''' + $parent_key + '''' And Asset = '''' + $asset + ''''

Any thoughts?

JJJ
  • 32,902
  • 20
  • 89
  • 102
czah
  • 49
  • 2
  • 7

2 Answers2

0

Try this..Use single quotes for the variables

SELECT ID,ACCOUNT,Key,MasterKey, key FROM Asset WHERE MasterKey = '$parent_key' And Asset = '$asset'
affaz
  • 1,191
  • 9
  • 23
0
"SELECT ID, ACCOUNT, Key, MasterKey, key FROM Asset WHERE MasterKey = '{$parent_key}' And Asset = '{$asset}'"

That may help.