Database Admins, help me with an sql statement please
Re: Database Admins, help me with an sql statement please
I don't know if you can do that with a simple sql query. You may have to write a pl/sql function.
"Ees gun! Ees not safe!"
-
- Senior Member
- Posts in topic: 1
- Posts: 923
- Joined: Tue Oct 23, 2007 3:12 am
- Location: Austin, TX
- Contact:
Re: Database Admins, help me with an sql statement please
if you're using mysql you want to use group_concat
If not mysql i'm sure your flavor has some equivalent.
Edit: While I believe this describes what you want it may not be the best choice depending on what you're trying to do. If you just want to view the results from the sql prompt that's probably fine. But if you're returning the results to your application it may be better to just wrap them up in there.
Code: Select all
SELECT work_tickets.ticket_id, group_concat(work_tickets_assignment.assigned_to)
FROM work_tickets JOIN
work_tickets_assignment using(ticket_id)
GROUP BY work_tickets.ticket_id
Edit: While I believe this describes what you want it may not be the best choice depending on what you're trying to do. If you just want to view the results from the sql prompt that's probably fine. But if you're returning the results to your application it may be better to just wrap them up in there.
-
- Senior Member
- Posts in topic: 1
- Posts: 1006
- Joined: Tue Jun 26, 2007 11:29 am
- Location: Pearland, TX
- Contact:
Re: Database Admins, help me with an sql statement please
sorry, that's the only sql i know :)SELECT * FROM users WHERE clue > 0
----------------------
0 Records returned
Re: Database Admins, help me with an sql statement please
you need to add an "order_by"
Please help the wounded store owner who fought off 3 robbers. He doesn't have medical insurance.
http://www.giveforward.com/ramoncastillo" onclick="window.open(this.href);return false;
http://www.click2houston.com/news/26249961/detail.html" onclick="window.open(this.href);return false;
http://www.giveforward.com/ramoncastillo" onclick="window.open(this.href);return false;
http://www.click2houston.com/news/26249961/detail.html" onclick="window.open(this.href);return false;