I want to find all ids of which group_concat only contains ‘a’. Here is simplified table from mine. ╔════╦══════════════╦ ║ id ║ group_concat ║ ╠════╬══════════════╬ ║ 1 ║ a,b,b ║ ║ 2 ║ a …
Tag: mysql
MySQL – Select on varchar column with 0 (zero) as criteria returns all rows?
Sorry in advance – this seems like a really dumb question. But… If I run a select query on a varchar() column, but use zero for the column value in the where clause – why does it return all rows? …
Find total count and average based of values from another table
In Mysql: I have customer name (primary key), cities and an amount in table: Table Cities: customer location amount Cust1 New York, USA 200 Cust2 New York, USA 300 …
mysql : check if column id is Consecutive [closed]
I have a table that contains IDs. +—-+ | id | +—-+ | 1 | | 2 | | 3 | | 4 | | 6 | | 9 | | 7 | | 10 | Number 5 and number 8 are not in the table. I want to select only those rows from the …
Update every 5 minutes a value
I am using a MySql DataBase and I want to know if there are any methods to modify a value of a column every x minutes/hours/days. For example, I want to execute the following query every 5 minutes, UPDATE table SET x=0;. Could I set an event or something like this from the PHPMyAdmin interface? Answer I’m not aware about
What’s the most efficient way of truncating the names in a first_name and last_name column to 1 character?
What’s the most efficient way of truncating the names in a first_name and last_name column to 1 character? I have a mysql database that I want to hand off to a developer but I want to partially …
MYSQL SUM(IF) with group by NAME but some NAME wanna makes sum
I have one question in SQL. This is the query. it makes a result below: but I wanna make Customer A and B sum together as A(not B) or new name(e.g. Z) like this: I want to modify the query and output it. Answer I understand that you want to group together customers A and B. You can do this
MySQL One row for each hour 00:01:00 and 23:59:00 interval of the day
I’m trying to get one row for each hour of the day, which I intent to left join certain data to. I need selected the 00:01:00 and 23:59:00 interval hour for each day. I have tried this solution but I can’t selected 00:01:00 and 23:59:00 interval hour but only 00:00:00 and 23:00:00 interval hour. How to do resolve this ?
sql – Add 0 after a numeric value
I have columns in my sql table. I am wondering how can I add zero after numeric values in my columns. So for example: I have values e.g 9, 2, 7, 10. I want to add a zero after these numbers. I want them to be 90, 20, 70, 100. There are some values in the columns that already have
How to use Distinct OR Group by with Inner Join?
have a problem with sql query, simple one but though I’m sitting on it 3d day and cant figure out what is wrong, please help. Table 1: Table 2 Result Desired result – in my reslt I want to display each portfolio ID ONLY ONCE. sql query: Any ideas / solutions are welcomed. Thank you Answer Use row_number(): EDIT: In