Re: [mysql] crosstabs

2007-07-31 Thread Geoff Nicol
A good article on crosstab queries in MySQL is located at: http://dev.mysql.com/tech-resources/articles/wizard/print_version.html A method of making a stored procedure based on the above article is hosted at: http://www.futhark.ch/mysql/106.html If you replace the 'sum' function with 'max' you c

Multi-user read/unread flag storage - Optimal DB Layout

2007-07-27 Thread Geoff Nicol
I am trying to design tables to track if a given user has viewed a change/addition or not. The basic layout of the database presently is: DocumentTable DocID,FileName,Description,Cost,etc... ChangeTable ChangeID,Date,UserID,DocID,ChangeDescription By looking in the ChangeTable I can tell what i

Rows to Columns - Based on mapping from other table

2007-07-25 Thread Geoff Nicol
All, I am presently accomplishing this problem in code but was wondering if I can have MySQL do the heavy lifting instead and get the advantage of sorting and whatnot. I have basically the following layout in my document tracking system to define various categories and then populate them with en