Maybe you would like to try group_concat(name)

-----Ursprüngliche Nachricht-----
Von: adnanayon [mailto:[email protected]]
Gesendet: Montag, 05. August 2013 18:21
An: [email protected]
Betreff: [sqlite] SQLite: group_concat() multiple columns format

My query is here

select abstracts_item._id,abstract_author.name,
title,affiliation_number,af_name from

abs_affiliation_name,abstract_affiliation,

abstracts_item,abstract_author,authors_abstract where

abstracts_item._id = authors_abstract.abstractsitem_id and

abstract_author._id = authors_abstract.abstractauthor_id and

abstract_affiliation._id = abstract_author._id and

abs_affiliation_name._id =  abstracts_item._id

After running the query I got data like this one

ID - NAME - TITLE - AFNUMBER - AFNAME
1  - A    -  AB   - 1,2      - CD
1  - B    -  AB   - 1,2      - CD
2  - C    -  BC   - 2,3      - VB
2  - D    -  BC   - 2,3      - VB

I want to get data like this

ID - NAME - TITLE  - AFNUMBER - AFNAME
1  - A,B  - AB     -  1,2     - CD
2  - C,D  - BC     -   2,3    - VB

I am try with this

SELECT _id,GROUP_CONCAT(TITLE) FROM(select 
abstracts_item._id,abstract_author.name, title, type, topic, 
text,affiliation_number,af_name from 
abs_affiliation_name,abstract_affiliation,abstracts_item,abstract_author,authors_abstract
where abstracts_item._id = authors_abstract.abstractsitem_id and 
abstract_author._id = authors_abstract.abstractauthor_id and 
abstract_affiliation._id = abstract_author._id and abs_affiliation_name._id = 
abstracts_item._id Order by 
abstracts_item._id,abstracts_item.title,abstract_author.name ) GROUP by 
_id,TITLE

But, it's not showing the correct data.




--
View this message in context: 
http://sqlite.1065341.n5.nabble.com/SQLite-group-concat-multiple-columns-format-tp70375.html
Sent from the SQLite mailing list archive at Nabble.com.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


--------------------------------------------------------------------------
 Gunter Hick
Software Engineer
Scientific Games International GmbH
Klitschgasse 2 – 4, A - 1130 Vienna, Austria
FN 157284 a, HG Wien
Tel: +43 1 80100 0
E-Mail: [email protected]

This e-mail is confidential and may well also be legally privileged. If you 
have received it in error, you are on notice as to its status and accordingly 
please notify us immediately by reply e-mail and then delete this message from 
your system. Please do not copy it or use it for any purposes, or disclose its 
contents to any person as to do so could be a breach of confidence. Thank you 
for your cooperation.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to