I have a query which returns two rows of data as count. I want to find sum of the column values. My sql: I have tried using Select Sum(my above query) but I am getting error. I just need some of above values. Answer Can grab both result sets in a single query:
Tag: mysql
How to get file extension of file as a result of sql query?
I have a table named datas and I’m executing a query like this: SELECT linkurl AS DOWNLOADURL, lastrevlevel AS VERSION, code AS DESCRIPTION, created AS RELEASEDATE, name …
How to convert all tables in database to one collation?
I’m getting error: Illegal mix of collations (utf8_general_ci,IMPLICIT) and (utf8_unicode_ci,IMPLICIT) for operation ‘='” I tried changing both tables manually to utf8_general_ci,IMPLICIT but I’m still getting the error. Is there a way to convert all tables to utf8_general_ci,IMPLICIT and be done with it? Answer You need to execute a alter table statement for each table. The statement would follow this form:
SQL query with avg and group by
I have some problems with writing a SQL query for MySQL. I have a table with the following structure: mysql> select id, pass, val from data_r1 limit 10; +————+————–+—————…
Alter SQL table – allow NULL column value
Initially, the table “MyTable” has been defined in the following way: CREATE TABLE IF NOT EXISTS `MyTable` ( `Col1` smallint(6) NOT NULL AUTO_INCREMENT, `Col2` smallint(6) DEFAULT NULL, `Col3` …
Formatting column in SQL
I would like to insert the pipe character | in a column to separate two sections of the output. Is there a way to put one in every row of a column as long as there is data in that row? Answer
Why am I getting an error in this create table script? [closed]
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. Closed 9 years ago. I’m attempting to write
Using group by on two fields and count in SQL
I have a table in my mysql db that has two columns: group and subgroup. See below. group, subGroup grp-A, sub-A grp-A, sub-A grp-A, sub-B grp-B, sub-A grp-B, sub-B grp-B, sub-B I am …
CREATE TYPE on MySQL
I couln’t create a new data type on MySQL. Query is given below How can I do that on MySQL Answer You cannot. MySQL doesn’t have user-defined types. (At least, not in current versions.)
Mysql queries giving error after upgrading
why this simple query not working. I know it was OK before I upgraded my mysql version. i know there are some syntax changes in new version that I done. but this is simple query no join, but not working. Please help me. EDIT: Upgraded from mysql4 to mysql5 and error is ‘syntax error’ Answer I think you upgraded from