Re: using COUNT in a WHERE

2004-04-26 Thread Sagi Bashari
Off the top of my head, I'm sure you'd do it like this: SELECT products.id, COUNT(orders.id) AS hits FROM products, orders WHERE orders.product_id = products.id AND hits >= products.quantity GROUP BY products.id Tried that: ERROR 1054: Unknown column 'hits' in 'where clause'

Re: using COUNT in a WHERE

2004-04-26 Thread Sagi Bashari
Michael Stassen wrote: No, you can't use an alias in the WHERE clause. Even if you could, you'd have a problem here. The WHERE clause is used to decide which rows to look at in advance of any calculations. You're asking mysql to count the rows which match the WHERE clause, but you're also as

Re: does mySQL support a boolean data type?

2003-07-13 Thread Sagi Bashari
Use unsigned tinyint(1) with 1 and 0 as values. On 13/07/2003 19:41, Dan Anderson wrote: I ran a search through the mySQL manual and google and could not find a satisfactory answer. Does mySQL support the declaration of a boolean data type? Currently I am using VARCHAR(6)s with either 'TRUE' or

utf8 support

2003-07-13 Thread Sagi Bashari
Hello, I would like to know the status of the UTF8 support in MySQL 4.1. I tried to create a table using utf8 charset, and inserting hebrew text into it. it seems like it still treats this text as binary - for example the length() function returns 8 on 4 chars string, or when cretting a column

Re: building tree view in mysql?

2002-05-27 Thread Sagi Bashari
he database once > (for optimum performance). > > - Carsten > > > -Oprindelig meddelelse- > > Fra: Sagi Bashari [mailto:[EMAIL PROTECTED]] > > Sendt: 27. maj 2002 20:50 > > Til: olinux; [EMAIL PROTECTED]; [EMAIL PROTECTED] > > Emne: Re: building tree

Re: building tree view in mysql?

2002-05-27 Thread Sagi Bashari
Yeah, thats exactly what I wanted to do. But how do I make MySQL sort it like that? Show the parent first, and then all its childs, so the application can determite if it's subcategory by checking if the parent is was changed. Sagi From: "olinux" <[EMAIL PROTECTED]> > create a table like this

building tree view in mysql?

2002-05-23 Thread Sagi Bashari
Hi, I'm trying to build a simple categories tree in MySQL. Say I have the following table: CREATE TABLE test ( id int(10) unsigned NOT NULL auto_increment, parent int(10) unsigned NOT NULL default '0', name tinytext NOT NULL, PRIMARY KEY (id), KEY parent (parent) ) TYPE=MyISAM; +---