hello guys,

i wanted to write a query, or a view to be exact to display data from two tables as follow:

1. schedule_table (scheduleID as pk)
2. remarks (remarkID as pk, scheduleID as fk)

meaning a schedule can contain many many remarks and non at all.

now the problem is i want to display the data in one line. for example:

1. scheduleID remark1, remark2, remark3, remark4.
2. scheduleID remark1, remark2
3. scehduleID

how do i go about doing this?

regards.
ch

Recommended Answers

All 2 Replies

Whole point of normalisation is to never have tables like this... Don't think that it is possible to do this in SQL unless you know what is maximal number of remarks for a schedule (ie. not greater than 3). If this is true you can do a series of inserts into temporary tables (ie. remark1, remark2, etc.) and then join them together.

thanks. i think i'll think about it and change the table structure.

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.