Re: Restrict inserts to meet certain conditions?

2007-09-29 Thread Rob Wultsch
I am sorry for sending multiple notes. The reply to is set not being set to mysql discussion list. I click the reply button automatically. This email is for the sake of the list sake... You want a feature like a check constraint: http://www.postgresql.org/docs/8.1/static/ddl-constraints.html whic

Re: Restrict inserts to meet certain conditions?

2007-09-29 Thread David Christopher Zentgraf
That's what I thought. Thanks! On 30. Sep 2007, at 14:55, Rob Wultsch wrote: CHECK CONSTRAINT I mean... On 9/29/07, Rob Wultsch <[EMAIL PROTECTED]> wrote: CONSTRAINT does not exist in mysql. You can use a trigger to deal with the issue, which is obviously less than ideal. On 9/29/07, Davi

SELECT ... LIKE and the Korean character set

2007-09-29 Thread verix
Hello. I have a question about the behavior of SELECT ... LIKE and dealing with the Korean language. For those who don't know anything about the way the language's characters are formulated, I'll give you a quick crash course: Korean has its own alphabet, just like Japanese, Chinese and most

Restrict inserts to meet certain conditions?

2007-09-29 Thread David Zentgraf
Hi, Is it possible to restrict Inserts and Updates to meet certain conditions? In one of my tables lets say field A, B and C can be NULL, but not all at once. Depending on what type of item I want to store, A needs to be NULL, but B and C need values, for other types A needs a value but B

How to call a stored procedure from a stored function with parameter?

2007-09-29 Thread Zsolt Csillag
Hello, I have the following stored procedure PROCEDURE `IsProductInForeignDatabase`(IN stock INTEGER(11), OUT MyResult VARCHAR(1000), IN Behaviour VARCHAR(20)) The procedure above returns the "MyResult" out parameter. I have a stored function as well thas has the body: Begin Declare MyResult

Re: Many-to-many query (chained)

2007-09-29 Thread Rapthor
Great! With a little adaption it works! Yes and of course I have to use another name for groups :) It was just an example. I have slightly different table settings. SELECT u.name FROM user u JOIN user_role ur ON u.id=ur.user_id AND (ur.role_id=1 OR ur.role_id=2) JOIN user_group ug ON u.id=ug.user

Re: Many-to-many query (chained)

2007-09-29 Thread Peter Brawley
Rapthor, Try ... SELECT u.name FROM user u JOIN user_role ur ON u.id=ur.user_id AND (u.id=1 OR u.id=2) JOIN user_group ug ON u.id=ug.user_id AND (u.id=1 OR u.id=2) HAVING COUNT( DISTINCT ur.role_id ) = 2 AND COUNT( DISTINCT ug.group_id ) = 2; BTW you can't name a table 'group'; it's a reserve

Many-to-many query (chained)

2007-09-29 Thread Rapthor
Hi SQLers, I am searching for an SQL command to combine several many-to-many queries. At the end I only want to get results suitable for all restrictions. Better show you my tables: USER id name 1 frank ROLE id name 1 admin 2 general GROUP id name 1 groupA 2 groupB USER_ROLE us