-1

I have the following statement that works in Visual Foxpro:

SELECT distinct auvcov.covtyp,aucoty.des,auvcov.vehnbr FROM auvcov
INNER JOIN aucoty ON UPPER(aucoty.covtyp) = UPPER(auvcov.covtyp) WHERE
between(STR(anumber,11,3)+STR(bnumber,2,0),STR(" & Anumber &
",11,3)+STR(0,2,0),STR(" & Bnumber& ",11,3)+STR(99,2,0))

Now I want to run it in MySQL. How can I correctly convert the statement?

Mnementh
  • 50,487
  • 48
  • 148
  • 202
  • Why don't you try doing it first, and if it doesn't work we'll help you. – Eric Hauenstein Jul 09 '15 at 12:15
  • it didn't work i don't have knowledge about visual foxpro i have problem in {between(STR(anumber,11,3)+STR(bnumber,2,0),STR(" & Anumber & ",11,3)+STR(0,2,0),STR(" & Bnumber& ",11,3)+STR(99,2,0))} section – Tejraj Shrestha Jul 09 '15 at 12:18
  • 1
    Please edit your question to include the above comment, as well as the error you receive. – Eric Hauenstein Jul 09 '15 at 12:20
  • The standard SQL for BETWEEN is BETWEEN AND . You're using VFP's native BETWEEN() function--change it to the other. – Tamar E. Granor Jul 09 '15 at 20:25
  • Can you edit this original question and add the following... actual table structure of the columns in question, and also some sample data to show what you have and what you are trying to get. It appears you are trying to add numeric values together to create longer strings and not doing actual math addition and converting to a string. Also, do not use tabs to format the sample data, but spaces and use the curly brackets button to show as formatted code. – DRapp Jul 12 '15 at 12:35

1 Answers1

0

AFAIK there is no direct equivalent of the VFP STR() function - the closest is the Format function to convert from numeric to string with specified number of decimal places. https://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_format. You would need to manually pad with leading spaces to get the same effect. This would be quite complex & likely very slow - it would probably be better to see if you could modify the query.

See this link : https://books.google.co.uk/books?id=NqQHylwqeZ4C&pg=PA309&lpg=PA309&dq=visual+foxpro+str+function+mysql+equivalent&source=bl&ots=hfTZLbFrCq&sig=kSP2OGDHaslc_2nxSQQs_wMmJKs&hl=en&sa=X&ei=a26eVfWLAoiXgwT-hYHgCg&ved=0CCEQ6AEwAA#v=onepage&q=visual%20foxpro%20str%20function%20mysql%20equivalent&f=false

PaulF
  • 6,673
  • 2
  • 18
  • 29