group-concat

order by within group concat

十年热恋 提交于 2019-12-07 11:28:31
问题 The order by is not working in the second query. I need to order by first DNAID then DNBID First Query its ordered as: 111221 Second Query its ordered as: 112112 for more info and details about what im trying to accomplish https://stackoverflow.com/questions/5082880/database-query-group-union-find-latest mysql> select * from metarun; +----+------------+-------+-------+--------------+----------+ | ID | RunGroupID | DNAID | DNBID | CONFIGTYPEID | DateTime | +----+------------+-------+-------+--

mysql join with multiple values in one column

十年热恋 提交于 2019-12-07 04:46:57
问题 I need to make a query that creates 3 columns that come from 2 tables which have the following relations: TABLE 1 has Column ID that relates to TABLE 2 with column ID2 In TABLE 1 there is a column called user In TABLE 2 there is a column called names There can be 1 unique user but there can be many names associated to that user. If i do the following i get all data BUT the user column repeats itself for each name it has associated. What i want is for use to appear unique but the names columns

How to use sum() within a group_concat()?

巧了我就是萌 提交于 2019-12-07 00:26:31
问题 Question revised Really wanted a group_concat of sums... Table: shops +---------+--------+--------+ | shop_id | name | state | +---------+--------+--------+ | 0 | shop 0 | 5 | | 1 | shop 1 | 5 | | 2 | shop 2 | 5 | | 3 | shop 3 | 2 | +---------+--------+--------+ Table: items +------------+--------------+ | shop | item | quantity | +------------+--------------+ | 0 | 0 | 1 | | 0 | 1 | 2 | | 0 | 2 | 3 | | 1 | 0 | 1 | | 1 | 1 | 2 | | 1 | 2 | 3 | | 2 | 0 | 1 | | 2 | 1 | 2 | | 2 | 2 | 3 | | 3 | 0

GROUP_CONCAT and LEFT_JOIN issue - Not all rows returned

*爱你&永不变心* 提交于 2019-12-06 11:51:19
Let's say my DB Scheme is as follows: T_PRODUCT id_product (int, primary) two entries: (id_product =1) , (id_product =2) T_USER id_user (int, primary) id_product (int, foreign key) name_user (varchar) two entries: (id_product=1,name_user='John') , (id_product=1,name_user='Mike') If I run a first query to get all products with their users (if there are any), I get this: SELECT T_PRODUCT.id_product, T_USER.name_user FROM T_PRODUCT LEFT JOIN T_USER on T_USER.id_product = T_PRODUCT.id_product; >> id_product name_user 1 John 1 Mike 2 NULL Looks good to me. Now if I want to the same thing, except I

Using MySQL GROUP_CONCAT or PIVOT on multiple joined tables

依然范特西╮ 提交于 2019-12-06 09:33:17
ISSUE I'm working on a content management system for a school, and I'd like to be able to create a view of multiple joined tables. In addition to joining the tables, I need to perform a PIVOT or GROUP_CONCAT (or some other function) in order to take multiple rows from each table and use them as columns in the view. To help visualize, here is a simplification of what I'm working with: SETUP STRUCTURE: DROP TABLE IF EXISTS `date`; CREATE TABLE `date` ( `col_pkid` int(11) NOT NULL AUTO_INCREMENT, `col_guid` varchar(100) NOT NULL DEFAULT '', `col_entry` varchar(100) NOT NULL, `col_inquiry_name`

group_concat was cut when running a query on table

≯℡__Kan透↙ 提交于 2019-12-06 09:22:04
问题 I have a table that looks likes this: and this table contains 343 rows. I'm trying to run this query on it: create table newTest2 select function_name, service_name, min(concurrency), substring_index(group_concat(date order by concurrency ), ',',1) as minDate, max(concurrency), substring_index(group_concat(date order by concurrency desc), ',',1) as maxDate , avg(concurrency) from conc_intermidate group by function_name,service_name; and when I run the query it gives me the : "row 203 was cut

MySQL - How to use subquery into IN statement by value

旧巷老猫 提交于 2019-12-06 06:58:42
问题 The question is to get table column data and use it as a value list for IN function; For this example I created 2 tables: movies and genres Table "movies" contains 3 columns: id, name and genre. Table "genres" contains 2 columns: id and name. +- movies-+ | |- movie_id - int(11) - AUTO_INCREMENT - PRIMARY | |- movie_name - varchar(255) | |- movie_genres - varchar(255) | | +- genres-+ |- genre_id - int(11) - AUTO_INCREMENT - PRIMARY |- genre_name - varchar(255) Both tables contain some dummy

MySQL: Increasing GROUP_CONCAT_MAX_LEN param - any dangers?

断了今生、忘了曾经 提交于 2019-12-06 06:43:33
问题 Right now, my MySQL server is using the default value of 1024 bytes for the GROUP_CONCAT_MAX_LEN, and I need to increase it. I am aware of the fact it is constrained by the MAX_ALLOWED_PACKET param, which is currently very sufficient in size. Will incraesing the GROUP_CONCAT_MAX_LEN affect anything? Does it have any consequences or dangers I should be aware of? Thanks. 回答1: Aside from increasing processing time in the MySQL server, and increasing traffic (even locally), no. If you do increase

Php and MySQL GROUP_CONCAT with separator comma and search where concat by comma

前提是你 提交于 2019-12-06 03:09:04
Is it that possible to select in Group_concat with separator comma and search where concat by comma Here My sample of mysql : products_attributes_id |products_id| options_id| options_values_id 39 | 31 | 3 | 3 35 | 30 | 2 | 2 38 | 30 | 1 | 1 40 | 31 | 2 | 2 41 | 30 | 1 | 4 42 | 30 | 1 | 5 43 | 31 | 1 | 4 I want to GROUP_CONCAT options_values_id SELECT * , GROUP_CONCAT(options_values_id SEPARATOR ',') FROM products_attributes GROUP by products_id products_attributes_id | products_id | options_id | options_values_id | options_values_id 35 | 30 | 2 | 2 | 2,1,4,5 39 | 31 | 3 | 3 | 3,2,4 Now my

MySQL group_concat with where clause

China☆狼群 提交于 2019-12-06 02:31:39
问题 I got this problem with Group_Concat and a where filter. In my table i got module names which are linked to a client. I want to search clients by module name, but in the group concat i still want to see all modules that are owned by the client. currently it will display all clients with those modules, but it will only display that specific module. I can't figure out how to make them both work together. Any suggestions on how to get my expected result?? These are some basic tables and the