0

hello everyone..
im student from indonesia n im newbie
ihave a problem n i need your help

ihave data from table, like that:

TGL || Tahun || semester || Keterangan

2010-1-1 || 2010 || Genap || LIbur tahun baru
2010-1-2 || 2010 || Genap || LIbur UAS
2010-1-3 || 2010 || Genap || LIbur UAS
2010-1-4 || 2010 || Genap || LIbur UAS
2010-1-15 || 2010 || Genap || LIbur UTS
2010-2-10 || 2010 || Genap || LIbur Semester genap
2010-2-11 || 2010 || Genap || LIbur Semester genap

ihave select tahun & semester to show this data.but iwant show the data like that:

TGL Libur || tahun-semester || keterangan

2010-1-1 || 2010-genap || LIbur tahun baru
2010-1-2 till 2010-1-4 || 2010-genap || LIbur UAS
2010-1-15 || 2010- Genap || LIbur UTS
2010-2-10 till 2010-2-11 || 2010-genap || LIbur Semester genap

how ican solved this problem?
what function php n query should i use?
before n after i said thanks very much for your help.

Edited by karet: sorry,,bad writed

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by asaizanm
0

use following query for expected result

SELECT concat(min(TGL ),' till ',max(TGL )) as tgl_libur,
concat(tahun,'-',semester) as tahun_semester, kererangan
FROM `table_name` group by 
tahun,semester , keterangan

Edited by urtrivedi: n/a

0

thank you very much bro urtrivedi. i will learn your clue. it will be some meaning for me.thanks

0

hello everyone..
im student from indonesia n im newbie
ihave a problem n i need your help

ihave data from table, like that:

TGL || Tahun || semester || Keterangan

2010-1-1 || 2010 || Genap || LIbur tahun baru
2010-1-2 || 2010 || Genap || LIbur UAS
2010-1-3 || 2010 || Genap || LIbur UAS
2010-1-4 || 2010 || Genap || LIbur UAS
2010-1-15 || 2010 || Genap || LIbur UTS
2010-2-10 || 2010 || Genap || LIbur Semester genap
2010-2-11 || 2010 || Genap || LIbur Semester genap

ihave select tahun & semester to show this data.but iwant show the data like that:

TGL Libur || tahun-semester || keterangan

2010-1-1 || 2010-genap || LIbur tahun baru
2010-1-2 till 2010-1-4 || 2010-genap || LIbur UAS
2010-1-15 || 2010- Genap || LIbur UTS
2010-2-10 till 2010-2-11 || 2010-genap || LIbur Semester genap

how ican solved this problem?
what function php n query should i use?
before n after i said thanks very much for your help.

Hello i'm from malaysia ..u can do the query like this, SELECT nameoftable."TGL Libur" ,nameoftable.keterangan
CONCAT(nameoftable.tahun,' - ',nameoftable.semester) AS tahunsemester
FROM nameoftable
ORDER BY nameoftable.tahun, nameoftable.keterangan

hope this will give u a piece of help ,i will not solve the issue but you the keyword for join together the column in temporary column is CONCAT ..OK.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.