> I have to admit that I am not sure how ANSI my SQL was, but > it works on > MS SQLServer (which is all I had to test it on when I made my > suggestion) using an analogous query on one of my own databases.
They are all the same. It's in the standard. Honest! :) I am yet to come across any database in real use that is full ANSI 92 compliant. > MS SQL 2000 does not seem to contain the concat function/operator and > Microsoft claims SQL 2000 is ANSI 92 compliant, so is concat > ANSI? I am > interested because I try to write ANSI SQL these days for portability. Yes, concat() is a mysql specific function and not part of ANSI spec. However use of + for string concatenation is not ANSI compliant either. The ANSI compliant way of concatenating strings is using the || operator. Such as: 'foo' || 'bar'. And while I have not worked with MS SQL 2000, I know for a fact that all versions prior and including 7.0 did not support this. But then neither does mysql (it treats it as logical or). Unfortunately it is sad reality of database work that if you need to do anything but the most basic tasks you will have to deviate from the ANSI standard. Still it is good to know the standards and try to follow them as closely as possible as it will allow easier port to new databases. > As for the order of precedence, I am afraid I am guessing here, but I > would have thought that keywords (such as LIKE) would be evaluated > before their arguments. The issue would then be the order within the > argument and I can't see a problem there. When you get MySQL going, try it and you'll see the results will be as predicted. :) Cheers, Dave. This e-mail and any attachments may be confidential or legally privileged. If you received this message in error or are not the intended recipient, you should destroy the e-mail message and any attachments or copies, and you are prohibited from retaining, distributing, disclosing or using any information contained herein. Please inform us of the erroneous delivery by return e-mail. Thank you for your co-operation. Mercer Human Resource Consulting Limited is regulated by the Financial Services Authority and is a member of the General Insurance Standards Council. Registered in England No. 984275. Registered Office: Telford House, 14 Tothill Street, London SW1H 9NB -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
