Simple SELECT/CONCAT query?
Hi, I have a question on how to make a simple search... I have two columns in a MySQLdb-table: item, price I want to list all items with their prices. However, items with the same price should be concatenated. I've looked through the manual - but can't figure out how to concat rows This is the result I'm looking for: ItemPrice -- Item 125 Item 2, Item 633 Item 335 etc /claire - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
query problem with GROUP BY and ORDER BY
Hi all, I have a table including two colums: names and apartment numbers: apt #| name -- 1 | Smith Joe 1 | Smith Anne 2 | Doe Richard 3 | Svensen Mike 3 | Brant Liza I need to get a list in alphabetical order, but with people in the same apt keept together: Brant, Svensen Doe Smith, Smith The difficulty is to get people living in the same apt grouped together. SELECT * FROM tbl GROUP BY apt ORDER BY name - will drop the second name found in each apt! (The result would be this list: Brant Doe Smith) I've been banging my head black and blue over this query! Can anyone help??!? Two more issues in addition to this query is: I'm using a PHP statement to find only the lastname in the name field, can this be done already in the query?? A nice feature would be to only list one name if both lastnames are the same in one apt. In other words the list would then look like: Brant, Svensen Doe Smith can this be done??? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
Extracting fields from a table
I want to select all entries in my table that in a column with given dates findes all dates inbetween $from_date - $to_date. (These are vars that the user supplies from the HTML-page). I don't know how to set up the SELECT query. I tried the following way but it didn't work: SELECT * FROM table WHERE (col=$from_date - col=$to_date) What is the correct way? - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php