Jump to content
Server Maintenance This Week. ×

Sql Syntax Help


This topic is 3557 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I need some help with executesql statements.

 

I am trying to compare a date in the Contracts table with a date stored in a global field in the BidR table.

 

I want to use executesql to get the date from the contracts table.

 

My statement is:

 

   ExecuteSql ( "SELECT estimatedawarddate_dt FROM contracts WHERE contracts.contractid_t = bidr.contractid_t";"";"")

 

The field "contractid_t" has the same value for both tables.  The returned value is"?" when the statement is executed.

 

Can anyone help with the syntax?

 

Also, how would I compare the date returned by sql with a filemaker date?

 

Thanks.

Link to comment
Share on other sites

My statement is:

 

ExecuteSql ( "SELECT estimatedawarddate_dt FROM contracts WHERE contracts.contractid_t = bidr.contractid_t";"";"")

 

Try

ExecuteSQL ( " 
  SELECT estimatedawarddate_dt 
  FROM contracts 
  WHERE contractid_t = ? 
  " ; "" ; "" ; bidr::contractid_t // this must be a field reference in FileMaker format, since it's a parameter of ExecuteSQL() 
)
Use the optional parameters, and the function will take care of any necessary type conversions, e.g. matching FM and SQL date formats, or implicitly quoting values when you query a text field.
Link to comment
Share on other sites

eos,

 

Thanks for your reply, your example helped me understand how to use an optional parameter, but I still get the same result..."?". 

 

I double checked the field data types, that they have actual dates in the fields, and the spelling of the table and field names.  It all seems syntactically correct.

 

I am not sure what else to check or do.

Link to comment
Share on other sites

This topic is 3557 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.