order/group query
Hi All, I have a string containing recordID's in a specific order (e.g. $string=17,2,33,5,99) How can I select those records from a table in the right order (as determined in $string)? SELECT * FROM table WHERE recordID IN ($string) results in the right records but not in the order I want, instead the order is determined by recordID... meaning (2,5,17,33,99) Any clues??:-) thx in advance! Many regards, Wilbert Enserink sql,query,queries,smallint - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] - - 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
select using 2 left joins
Hi all, I'm having troubles with a good selection statement in my query. I have three tables: tableAds, tableProducts and tableManufacturer. They all have unique ID's defined. In the tableProducts there is a column named manufacturerID. So I know which product was made by which manufacturer. In the tableAds I have a column ProductsID so I know what Product is advertised. Now I want to find all the adsvertisments of products which are made by a specific manufacturer. I'm trying a query like: SELECT * FROM tableAds LEFT JOIN tableProducts ON (tableProducts.productsID=tableAds.productsID) LEFT JOIN tableManufacturers ON (tableManufacturers.manufacturersID=tableProducts.manufacturersID) WHERE manufacturersID=12 However this query returns all advertisments in the tableAds and not the Ads wirth manufacturer number 12 involved. Anybody knows how to improve this query? Any help would be much appreciated. thx in advance. Wilbert Enserink - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] - - 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
mysql query: left join with same column names
Hi all, I have to tables A and B. They boyh have a column with the same name. Now, I wrote this MySQL statement performing a left join. This results in a data set with rows consisting of 2 columns of the same name, in which the date is stored when the record was last altered. This column is called last_altered. Later on in my script I'm calling the value of this column with php. $query=select * from tblA LEFT JOIN ; $resultID=mysql_query($query); while ($result_row=mysql_fetch_array($resultID)) { echo $result_row[column with the same name]; } Well, this works without any php or mysql errors, but it is giving me the data back of that column wich I don't wanna have...It returns the last_altered date of tblB in stead of tblA. A solution might be te exclude the second column (the wrong one) from the select statement in the query. Anybody knows how this can be done?? Or are there other solutions? thx Wilbert Enserink - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] - - 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
temporary table query
hi all I'm using this query: CREATE temporary TABLE temptable SELECT * FROM gallery INNER JOIN designers ON (designers.designersID=gallery.designersID) WHERE (LOWER(gallery.omschrijving) LIKE '%$search%' OR LOWER(gallery.productnaam) LIKE '%$search%' OR LOWER(voornaam) LIKE '%$search%' OR LOWER(achternaam) LIKE '%$search%') now I get the result back: Duplicate column name 'designersID' DesignersID is a column in table gallery and in table designers- which explains my LEFT JOIN. So I understand that MySQL is trying to build a table with 2 columns with the same name: designersID... anybody knows how to overcome this problem? thx and regards. Wilbert - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] - - 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
temporary table
hi all, i have this php script which queries a table. The results are stored in a temprrary table CREATE temporary TABLE t1 SELECT .statements...; when I query this table in the same script i can see that the results wore indeed stored in t1. however when i call this table from a different script I get the error thet t1 doesn't exists anybody knows why? (mysql 3.23) thx Wilbert - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] - - 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
WHERE MATCH () AGAINST ('%$search_string%');
hi all, i'm new to this list. currently busy with mysql. I'm having troubles with the query string below. The part MATCH results in an error: Can't find FULLTEXT index matching the column list however it looks like i'm doing the query according to the manual. Anybody has any clue what's going wrong here? $query=SELECT * FROM gallery LEFT JOIN designers ON (designers.designersID=gallery.designersID) WHERE MATCH (gallery.productname, gallery.productnumber) AGAINST ('%$search_string%'); thx. Regards Wilbert - Pas de Deux Van Mierisstraat 25 2526 NM Den Haag tel 070 4450855 fax 070 4450852 http://www.pdd.nl [EMAIL PROTECTED] - - 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