Skip to content
Advertisement

Tag: mysql

What’s wrong with my SQL query?

I need a quick look at my SQL query. It’s already given me a headache. Comparing some advice I have gotten, I could not figure out the proper format for my SQL. This is my code: Thanks in advance! EDIT: Currently I have this as the form: This is the insert query: Seems to submit the entry, but not the

sort the “rollup” in group by

I found that the “with rollup” option used with group by is very useful. But it does not behave with “order by” clause. Is there any way to order by the way I want as well as calculate the sub-totals? …

MAX on columns generated by SUM and GROUP BY

I’m trying to get the MAX on a column which is generated dynamically using the SUM statement. The SUM statement is used together with the ‘GROUP by’ syntax. This is the original query, however it needs to be modified to work with grouping, sums and of course MAX. As you can see SUM is adding all the values inside video_plays

How can I print the SQL query executed after Perl’s DBI fills in the placeholders?

I’m using Perl’s DBI module. I prepare a statement using placeholders, then execute the query. Is it possible to print out the final query that was executed without manually escaping the parameters and dropping them into the placeholders? Thanks Answer See Tracing in DBI. The following works using DBD::SQLite but produces a lot of output: Output: <- prepare(‘SELECT … FROM

Can MySQL replace multiple characters?

I’m trying to replace a bunch of characters in a MySQL field. I know the REPLACE function but that only replaces one string at a time. I can’t see any appropriate functions in the manual. Can I replace or delete multiple strings at once? For example I need to replace spaces with dashes and remove other punctuation. Answer You can

Advertisement