Have you looked at this page of the manual? http://dev.mysql.com/doc/mysql/en/string-comparison-functions.html
It describes several ways to do the sort of searches you want to do and there are several examples. You might find that LIKE or STRCMP() work better than REGEXP for your requirements. Rhino -----Original Message----- From: admin [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 14, 2005 1:02 PM To: mysql@lists.mysql.com Cc: mysql@lists.mysql.com Subject: How to write subqueries? Hello! MySQL v. 4.1.11. I'm trying to write a subquery, MySQL says "Error". select num, theme, intro from vt_(select pnid from vt_partition where pnid regexp '^[0-9]{11}$') order by date desc, timer desc; describe vt_parition: +----------+--------------+------+-----+----------+----------------+ | Field | Type | Null | Key | Default | Extra | +----------+--------------+------+-----+----------+----------------+ | num | int(11) | | MUL | NULL | auto_increment | | partname | varchar(255) | | | | | | pnid | varchar(11) | | | | | | timer | time | | | 00:00:00 | | +----------+--------------+------+-----+----------+----------------+ describe vt_24411620611; +-------+--------------+------+-----+------------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+--------------+------+-----+------------+----------------+ | num | int(11) | | MUL | NULL | auto_increment | | login | varchar(10) | | | | | | mail | varchar(35) | | | | | | theme | varchar(100) | | | | | | intro | text | | | | | | text | text | | | | | | date | date | | | 0000-00-00 | | | timer | time | | | 00:00:00 | | +-------+--------------+------+-----+------------+----------------+ "vt_" is a prefix, "pnid" is a postfix. And the name of the table is, for expamle, vt_01234567890. Where is/are the mistake(s) in my subquery? Please explain me how to write a subquery in the right way. -- Good luck! Vladimir Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]