Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.
SELECT CONCAT_WS(parent_title, parent_fname, parent_sname) AS 'Parent'
CONCAT ('£1.50', sum(activity_price) AS Amount, COUNT(*) AS 'N.Activities'
FROM Activities A, Parent P, Child C, Register R
WHERE C.parent_id=P.parent_id AND C.child_id=R.child_id AND A.activity_id=R.activity_id
GROUP BY P.parent_id;

The Query browser says error is near the 'CONCAT(£1.50', sum(activity_price)....... FROM at line 2.

share|improve this question
1  
The CONCAT's argument list is never closed with a ) in your query, as noted by Jon Seigel. On the other hand, it is not clear what particularly you are intending to concatenate there. Could there be an omission between '£1.50', and sum(…? –  Andriy M Jul 20 '12 at 5:05
add comment

closed as too localized by Derek Downey, Mark Storey-Smith, JNK Aug 9 '12 at 20:24

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

I'm not a MySQL expert, but it looks like:

SELECT CONCAT_WS(parent_title, parent_fname, parent_sname) AS 'Parent'
    CONCAT ('£1.50', sum(activity_price) AS Amount

should be:

SELECT CONCAT_WS(parent_title, parent_fname, parent_sname) AS 'Parent',
    CONCAT ('£1.50', sum(activity_price)) AS Amount

I added a comma after the first result column, and a trailing bracket to the CONCAT function.

While I have no idea if the latter concatenation is a valid operation, what I've suggested should fix the basic syntax errors.

share|improve this answer
    
+1 for having a good eye for SQL !!! –  RolandoMySQLDBA Jul 20 '12 at 3:04
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.