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.

Recommended Answers

All 3 Replies

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

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

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.