How To Search Other Tables In Search Query
I've got a search query for my website that I'm having problems with. Basically I can't get it to search the fields "summ_towns.town_name", "summ_states.state_name", "summ_countries.country_name" because they're not in the same table I can't include them in my MATCH/AGAINST query.
What I'd like to do is search against a town, then state, then country before getting to the MATCH/AGAINST clause. I've tried including OR operators to do this, but it always mucks up the AND clauses above.
Would someone be able to show me how I can do this without confusing the different operators?
View Complete Forum Thread with Replies
Related Forum Messages:
Search: Remove Quotes From Database For Search
I am making a book site and currently in the database are book titles likes "John's Trip" and "Peter's new bike". I have a search function where the customer can type in "Peter's" and it will bring up everything with "Peter's" in it. But i was wonderind is there any way i can search for "Peters" and "Johns".
View Replies !
How To Search Over 3 Tables
The project we're working on is a document retrieval system I have 3 tables as follows. Table 1 contains words from a example doc. Table 2 contains words from documents in a database. Table3 contain only one column ‘DocID’. I would like to search the database to find those docs similar to the example doc by calculating similarity score between the example doc and each doc in the database. Specifically, the simi score is calculated by adding up the sum of word frequencies of all matched word. Additionally, I am only interested in the those documents whose DocID appear in table3. Code: Table 1 Word Freq Book 2 Desk 3 Pen 3 Board 3 Table2 DocID Word Freq 1 Book 3 1 English 2 1 Math 1 2 Desk 2 2 Machine 5 2 Power 2 3 Desk 3 3 Teacher 3 3 Class 2 4 Building 1 4 Tower 2 Table3 DocID 1 2 I am not sure the following statement is correct or not Code: SELECT DocID, table1.Freq+ table2.Freq FROM table1, table2, table3 WHERE table1.Word = table2.Word AND table2.DocID = table3.DocID;
View Replies !
Search From 2 Tables
I have 2 tables, A and B. Both have these field names 'Name' and 'Password'. Now I would like to combine A and B together so that I can check whether the password and name a user has entered is valid, regardless in A or B. Next, I want to know in which table the matching occurs, in A or B, if the entry is valid. So lets say if the entry entered matched an entry in B, I will know this result: username and password valid in table B. I know I can do this separately, but just wonder can I do this all in one step.
View Replies !
SQL Search From 2 Or More Tables
i have member, nonmember & non_ind_member table plus a client table. how can i do a select statement to join member & client, nonmember & client, and non_ind_member & client and retrieve the members' code, members' name and clients' name? i want to get 4 similar fields from the 3 tables each, where the clientCode on the 3 members tables is a foreign key to clientCode on client table. now i can only get from 1 table. how to get from 3 more tables?
View Replies !
Fulltext Search Search Blob?
Does the fulltext search is a good way to find words in a table which contains more than 500'000 rows, moreover it will search in blob field. What's your opinion about fulltext in big table ?
View Replies !
Search Through Multiple Tables
I currently have an Access DB I migrated into MySQL. The DB conists of multiple tables representing the same data but differentiated by month Ie. table 2003 07 consists of field 1,2,3, etc table 2003 08 consists of field 1,2,3, etc where the field properties don't change Is it possible to run a query through all tables at once (ie. to find where field 3 = xyz) If not, what would be the best course of action all the DB i'm looking to migrate are in this format.
View Replies !
Search On Multiple Tables?
ok I've got 3 tables all with almost the same structure, they all have an ID and a search colmumn like this: Table A: AID | Search Table B: BID | Search Table C: CID | Search ATM I'm having query to 3 times and array sorting them in php which is resource unfriendly. Is there a way I can search all the 'Search' columns using 1 mysql query?
View Replies !
Search Multiple Tables
I have two tables that have item information that I am trying to make a search for. I have it working for searching one table, but I can't figure out how to make it search both. Current: "SELECT * FROM `god_items` WHERE `item_name` LIKE '%$search%' OR `guardian` LIKE '%$search%' ORDER BY type ASC" second table is set_items
View Replies !
How To Search In Multiple Tables
i want to search in multiple tables with selected fields in each table, i make a query like this: SELECT location_id FROM locations_mast WHERE description like '%$Keyword%' union SELECT course_id FROM courses_mast WHERE description like '%$Keyword%' its giving me results but as the "union" use the first SELECT statement as the column names for the results, its giving me only one record set as "location_id" i want all the separate column names in the record set as location_id, course_id so on...
View Replies !
FULLTEXT Search On 2 Tables
I am trying to do a FULLTEXT search on 2 tables containing products. The tables are default_products and custom_products. The custom_products is used to store customized data about the products and may have null values. These tables are linked by their product_id's. Initially I tried to do a FULLTEXT search using COALESCE which looked like this:
View Replies !
Search Query Using 'LIKE'
modify search query using LIKE %search% so that for eg: when we search for 'men' output contains only those with word 'men' and not with words 'women' , 'sacrament','menthol' etc.or is there a different query for this.
View Replies !
Joining Two Tables For A Search Engine
let's say I have 3 tables. one has titles, one has words, and an index where each title is broken into words (title_id and word_id) I want to be able to search terms in any order, so "potter harry" is the same as "harry potter". select t.name from titles t, words w, index i where (w.name in ('harry", "potter")) and (w.word_id = i.id) and (i.title_id = t.id); This produces a list of titles matching my search times. however, with over 3 million products, it can be quite slow. 3 seconds is too slow. sometimes it takes a minute. is there a better way to do a join when there are more search terms like "harry potter and the chamber of secrets"? the fastest way I found was to get the word count for each term, join on the least used word, and then make sure the remaining terms are in the titles. but sometimes it returns 10,000+ titles.
View Replies !
FULLTEXT Search Across Multiple Tables
Code: SELECT SQL_CALC_FOUND_ROWS DISTINCT(summ_listings.listing_id), TRIM(summ_listings.listing_name) AS listing_name, TRIM(SUBSTRING(summ_listings.listing_description,1,180)) AS listing_desc, summ_listings.listing_bedrooms, TRIM(summ_listings.listing_estate) AS listing_estate, summ_images.image_thumb, summ_towns.town_name, summ_states.state_name, summ_countries.country_name FROM summ_listings LEFT JOIN summ_images ON summ_images.listing_id = summ_listings.listing_id AND image_default = 1 LEFT JOIN summ_towns ON summ_listings.town_id = summ_towns.town_id LEFT JOIN summ_states ON summ_listings.state_id = summ_states.state_id LEFT JOIN summ_countries ON summ_listings.country_id = summ_countries.country_id WHERE summ_listings.listing_expires > CURRENT_TIMESTAMP ORDER BY summ_listings.listing_last_updated DESC LIMIT 0, 10;
View Replies !
Search Multiple Tables With Same Data
I have 3 tables where Product col is the same across all 3. Tables id /Product / Price So far I have been using $query = "Select `product`, `price` as p, 'tbl1' as n from `tbl1` where `product` REGEXP '".$trimmed."' UNION ALL Select `product`, `price` as p, 'tbl2' as n from `tbl2` where `product` REGEXP '".$trimmed."' UNION ALL Select `product`, `price` as p, 'tbl3' as n from `tbl3` where `product` REGEXP '".$trimmed."' ORDER by `name`"; Output gives me Product | vendor | Price Wanting to do a search where product is combine from all 3 tables and prices in different colums - >output Product | Price (tbl1) | Price (tbl2) | Price (tbl3) Any idea's ?
View Replies !
Fulltext Search: Multiple Tables
Let's say I have two tables: TblCategory (with CatID and CatName) and TblProduct (with ProID and ProName). I want to od the equivalent of MySQL's fulltext search, but I want it to match CatName or ProName. I know the MySQL's fulltext search is only for single tables.
View Replies !
Mysql Search Query
i would like to write a query to seach for the related information to display. let say the user key in the word "sql", and in one of my keyword field i have data such as "mysql, database, java" and i want to call this row out, how can i do this?
View Replies !
Boolean Search Query
I have a problem with a boolean search on a table.If I run the following query, I get results SELECT * from syslogd where msghostname like "%10.222%" and msgtext like '%bgp%' limit 1500; however if I run this, I get nothing. SELECT * from syslogd where msghostname like "%10.222%" and match(msgtext) against ('*bgp*' in boolean mode) limit 1500; I can run this command and get results SELECT * from syslogd where msghostname like "%PE_" and match(msgtext) against ('*bgp*' in boolean mode) limit 1500; Whats wrong with my second command??
View Replies !
Search Query By Date
I'm trying to adjust an older search query to perform a search by date where the date column is an INT field (unix date stamp). SELECT * FROM incidents WHERE date < DATE_ADD (CURDATE(), INTERVAL $searchDate DAY); Where date, formally a DATE field, is now an INT(11) field. $searchDate is an int, indicating how many days back to search. 1 (day), 5 (days), etc.I'm assuming mysql's DATE_ADD function is specific to the DATE field. How can I achieve the same result, but with an INT field?
View Replies !
Correct Search Query
Can anyone help me out with this please. I am looking at searching among comma delimited id's stored inside "IDs", trying to figure out what the correct SQL query for that would be. I need to extract the ID where IDs contains the value 7. I know I can't use something like "WHERE IDs LIKE '%7%'" because the result would be inaccurate. So how do I go about it, please? Any directions would be appreciated, thanks! +------+-----------+ | ID | IDs | +------+-----------+ | 1 | 3,17,20 | +------+-----------+ | 2 | 1,7,9,12 | +------+-----------+
View Replies !
Date Search Query Help
I'm trying to filter my search results by date. The field name I'm running this for is final_date and is a DATE field. I want my results to show records that have sales_reps.final_date within the past 30 days. Query: SELECT sales_reps.sr_id, sales_reps.name, sales_reps.job_number, sales_reps.status, sales_reps.stage, UNIX_TIMESTAMP(sales_reps.final_date) as final_date, UNIX_TIMESTAMP(sales_reps.date_to_shop) as date_to_shop, shop_orders.community, users.user_id, u.fname, u.lname, users.builder, users.division, ei.shop_result, ei.good_tape, sa.shopper_id, shop_orders.order_id, UNIX_TIMESTAMP(shop_orders.date) as order_date, pi.fname as pfname, pi.lname as plname , ei.exit_id FROM sales_reps LEFT JOIN shop_orders ON sales_reps.order_id=shop_orders.order_id LEFT JOIN users ON users.user_id=shop_orders.builder_id LEFT JOIN report_types ON report_types.type_id=sales_reps.report_type LEFT JOIN shop_assignments as sa ON sa.sr_id=sales_reps.sr_id LEFT JOIN exit_interviews as ei ON ei.shop_id=sa.shop_id LEFT JOIN users as u ON u.user_id=sa.shopper_id LEFT JOIN users as pi ON pi.user_id=sa.pi_id WHERE DATE_SUB(CURDATE(), INTERVAL 30 DAY) <=UNIX_TIMESTAMP(sales_reps.final_date) AND (sales_reps.status = 'Completed' OR sales_reps.status = 'Rejected') ORDER BY users.builder, users.division, community ASC, final_date ASC Is this: WHERE DATE_SUB(CURDATE(), INTERVAL 30 DAY) <=UNIX_TIMESTAMP(sales_reps.final_date) incorrect? I'm getting dates such as 2007-03-22 and 2007-03-19 in my result set and they shouldn't be there. Could I get some pointers?
View Replies !
Looking For Help In Getting Proper Search Results From Two MySQL Tables
I am building a site where there are several travel related products in a MySQL database. Each product has "x" amount of items. For example, Harrison Hot Springs Hotel has 3 items - Cash price, Points, and Points plus Cash. I need to do a search on "items" that are equal to or less than the number of Points (item_points) and just can't seem to get it right. Their are two tables involved "products" and "prod_items". This is the code I am using to get search results by product category and it works just fine. I'm sorry I've tried to indent my code properly so it's easier to read but don't know how to do that here. //get product info and show $get_prods = "select id, prod_name, city, prod_brief, valid_m, valid_d, valid_y, expiry_m, expiry_d, expiry_y from products where category='$category' order by city, prod_name"; $get_prods_res = mysql_query($get_prods) or die(mysql_error()); while ($prods = mysql_fetch_array($get_prods_res)) { $prod_id = $prods[id]; $prod_name = stripslashes($prods[prod_name]); $city = stripslashes($prods[city]); $prod_brief = stripslashes($prods[prod_brief]); $valid_m = $prods[valid_m]; $valid_d = $prods[valid_d]; $valid_y = $prods[valid_y]; $expiry_m = $prods[expiry_m]; $expiry_d = $prods[expiry_d]; $expiry_y = $prods[expiry_y]; echo "$prod_name - $city - <a href="prod_details.php?prod_id=$prod_id">Details</a><br><br> $prod_brief<br><br> Purchase options for this product are valid until $expiry_m $expiry_d, $expiry_y <br>"; $prod_name = addslashes($prods[prod_name]); //get item codes $get_codes = "select item_code, item_desc, item_points, item_cash from prod_items where prod_name = '$prod_name' order by item_code"; $get_codes_res = mysql_query($get_codes) or die(mysql_error()); if (mysql_num_rows($get_codes_res) > 0) { while ($codes = mysql_fetch_array($get_codes_res)) { $prod_name = stripslashes($prods[prod_name]); $item_code = $codes['item_code']; $item_desc = $codes['item_desc']; $item_desc = stripslashes($codes['item_desc']); $item_points = $codes['item_points']; $item_points = number_format($item_points); $item_cash = $codes['item_cash']; $item_cash = number_format($item_cash, 2); if ($item_points == 0) { echo "$item_code - $item_desc - $$item_cash<br>"; } elseif ($item_cash == 0.00) { echo "$item_code - $item_desc - $item_points points<br>"; } else { echo " $item_code - $item_desc - $item_points points plus $$item_cash <br>"; } } } }
View Replies !
String Search In MySQL Query
trying to port my application from SQLite to MySQL database. I believe MySQL by default searches string in case insensitive manner while using '=' and 'like' operators in SELECT statement. I have changed the default collation of the MySQL server to ''latin1_general_cs" from "latin1_swedish_ci". After doing this, the string search is case sensitive for both '=' and 'like' operators. But I would like to search string by case sensitive in '=' operator and case insensitive in 'like' operator (as SQLite does).
View Replies !
Tire Size Search Query
I have a table of tire sizes... example: 245/40 YR18, 245/40 W18 I need to search through that table, and pick out sizes based on a search that would like like this: P245/40ZR18 I want to find tires based on the 'P245/40' and '18'... any combination of letters between the two are fine.... seems like a regular expression seach?
View Replies !
[PHP, MySQL, FLASH] - Search Query
just a quick question what would be the best way to search a database, how should i query it? i have this so far: <? $name=$_GET['name']; $company=$_GET['company']; $address=$_GET['address']; $phone=$_GET['phone']; $email=$_GET['email']; $web=$_GET['web']; mysql_pconnect("host","random","random") or die ("didn't connect to mysql"); mysql_select_db("database") or die ("no database"); $query = "SELECT * FROM table_name WHERE Name, Company = '$name' AND '$company'"; $result = mysql_query( $query ) or die ("didn't query"); $num = mysql_num_rows( $result ); //echo ($num); if ($num == 1){ while ($line=mysql_fetch_array($result)) { $profile = "name_show=" . $line['Name']; $profile = "company_show=" . $line['Company']; //$profile = "address_show=" . $line['Address']; //$profile = "phone_show=" . $line['Phone']; //$profile = "email_show=" . $line['Email']; //$profile = "web_show=" . $line['Web']; } print $profile; } else { print "error=Sorry, but I can't show results"; } ?> it works but not very dynamically, when both companys are commented out in the while and query statements. What i hope to have is a search where users can type in 1 letter and it will give them a result with all records having that letter in them and just by filling in one item in flash instead of all of them in order to begin the search.
View Replies !
Query A Thesaurus For Search Terms?
I was wondering what the best way is to expand on user-inputted search terms. For instance, when conducting a search, I would like to ALSO query all synonyms and related words to the inputted search terms. The database my script searches is very large, so inputting my own related words and synonyms alongside every searched value in the database would be a real pain in the neck if I had to go that route. Is there some sort of downloadable database of all words and their relations I could use?
View Replies !
Simple Query To Search By Tags
I have a straightforward tagging setup: places (id, title) taggings(place_id, tag_id) tags(id, title) I'm trying to write a simple query that returns places with certain tags. I can write the query that returns places for one tag (select * from places, taggings, tags where places.id = taggings.place_id and taggings.tag_id = tags.id and tags.title = "sushi"). I need to write a query that returns all places based on multiple tags. For example, if a user searches for "cheap" and "sushi" it should return places that are tagged as both "cheap" and "sushi".
View Replies !
Autocomplete Query For Search Form
$sql = 'SELECT * FROM `names` WHERE `name` LIKE "' . mysql_real_escape_string($partialTerm) . '%";'; My problem is that using the above a term "Da" will successfully match "Dave", "Daniel", "Davina" etc but it will not match "Steve Davis". typing "Da" and got "Steve Davis" this would be wrong but I want it to show "Davis". Basically how can I search ALL separate words found in the name column of my MySQL table? Currently the query would only return the string "this is a an example" if I entered the first letter of the search term as "t". I want to be able to type "e" and be shown "example".
View Replies !
FULL TEXT (match) Search Across Multiple Tables
Hey, i'm trying to create a "search the site" field on my page. My site allows users to upload pictures and give them titles and descriptions. To search the whole site i'd need to search say the user database (name, short bio), and the image database (description, title) and return the results. now, i've managed to do this by running the query once on each table and then sorting the total results by their relevence. the problem i'm facing is in regards to pagination. If i set a limit for the results that limit would be applied to both queries and i would end up getting a different ammount of results per page depending on how many showed up in each query. If i could run ONE query with the limit i imagine i'd be able to solve this. I hope that wasn't confusing. Also if anyone has an idea how to use the current multiple queries and paginate them accordingly i could use that as well. I've included a sample of the queries i'm using to search each table. $sql="SELECT photos_gallery.image_id,(MATCH(photos_gallery.image_title) AGAINST('$search_string' IN BOOLEAN MODE)*100) + (MATCH(photos_gallery.image_desc) AGAINST('$search_string' IN BOOLEAN MODE)*10) AS rating FROM photos_gallery WHERE MATCH(image_title,image_desc) AGAINST('$search_string' IN BOOLEAN MODE) ORDER BY rating DESC LIMIT ".$page.",".$limit.""; $sql="SELECT `users_id`,(MATCH(users_name) AGAINST('$search_string' IN BOOLEAN MODE)*100) + (MATCH(users_bio) AGAINST('$search_string' IN BOOLEAN MODE)*10) AS rating FROM users WHERE MATCH(users_name,users_bio) AGAINST('$search_string' IN BOOLEAN MODE) ORDER BY rating DESC LIMIT ".$page.",".$limit."";
View Replies !
Performing Fulltext Search On Multiple Related Tables
trying to add fulltext search to multiple related tables. Here are the tables: I have a table named book that contains details about every book another table named author which holds the names, bio etc. of every author and a lookup table to join the two since each book can have multiple authors and each author could be associated with several books. I would like people to be able to search by keywords from the book table or by author name. This is the query that I came up with: ....
View Replies !
FULL TEXT (match) Search Across Multiple Tables?
i'm trying to create a "search the site" field on my page. My site allows users to upload pictures and give them titles and descriptions. To search the whole site i'd need to search say the user database (name, short bio), and the image database (description, title) and return the results. now, i've managed to do this by running the query once on each table and then sorting the total results by their relevence. the problem i'm facing is in regards to pagination. If i set a limit for the results that limit would be applied to both queries and i would end up getting a different ammount of results per page depending on how many showed up in each query. If i could run ONE query with the limit i imagine i'd be able to solve this. I hope that wasn't confusing. Also if anyone has an idea how to use the current multiple queries and paginate them accordingly i could use that as well. I've included a sample of the queries i'm using to search each table. PHP $sql="SELECT photos_gallery.image_id,(MATCH(photos_gallery.image_title) AGAINST('$search_string' IN BOOLEAN MODE)*100) + (MATCH(photos_gallery.image_desc) AGAINST('$search_string' IN BOOLEAN MODE)*10) AS rating FROM photos_gallery WHERE MATCH(image_title,image_desc) AGAINST('$search_string' IN BOOLEAN MODE) ORDER BY rating DESC LIMIT ".$page.",".$limit.""; $sql="SELECT `users_id`,(MATCH(users_name) AGAINST('$search_string' IN BOOLEAN MODE)*100) + (MATCH(users_bio) AGAINST('$search_string' IN BOOLEAN MODE)*10) AS rating FROM users WHERE MATCH(users_name,users_bio) AGAINST('$search_string' IN BOOLEAN MODE) ORDER BY rating DESC LIMIT ".$page.",".$limit."";
View Replies !
MySQL Table Data Search Query
I have two tables as follows: table 'question' with fields 'patient_id', 'answer_id' and 'terms', and table 'answer' with fields 'answer_id' and 'answer_path'. I need to search question.terms for a keyword match and then join that match to the corresponding foreign key (answer_id) in table answer to return 'answer_path'.
View Replies !
Mysql Query Search And Find In String
I have following values in a field of mysql table. These values are stored as string [varchar] in the field. Values : 3,4,10,21,20,8,100,2,6 How can I check through MYSQL query that 100 or 21 or 4 exists in the string?
View Replies !
Query To Search And Retrieve File For Download
I am new to web development and have this challenge. I want to design a dynamic website for a college community using PHP and MYSQL. The objective of the site is to hold the annual report of all the departments such that visitors can select the desired department and the year of the report. The years could stretch back to as long as the college existed but I want to limit the backdate to 10 years for now. The visitor should be able to select a department and desired year, view the report online and also be able to download the same report stored in a directory in ms word or PDF format. What should the table structure look like? Also the PHP and SQL script to search for the stored files and make them available for download.
View Replies !
SQL Query Problems (for Use With A Sort Of Live Search)
I created some code that loaded information from an XML file, but many thanks to jimfraser on here I'm working on a solution that'll drag it directly from the database. Problem is, it's not displaying anything at all, so I assume there's a problem with the SQL query or the way it's being presented on the page. PHP <?php $network = new COM("WScript.Network"); include_once('../../../functions/datalib.php'); $db = new oracleClass(); $conn = $db->connect(); //get the q parameter from URL $q=$_GET["q"]; //lookup all links from the xml file if length of q>0 if (strlen($q) > 0) { $hint=""; // connect to the database $sqlstatement = 'select * from TEST."WFO_REPORTS_ALLEMPS" order by "Surname", "Forenames"' $sqlListings = OCI_Parse($conn, $sqlstatement); OCI_Execute($sqlListings); while(OCI_Fetch($sqlListings)) { $name = oci_result($sqlListings, "Forenames") . ($sqlListings, "Surname") //find a link matching the search text if (strchr($name,$q)) { if ($hint != "") { $hint .= "<br />"; } $hint .= "<a href='#' onclick='employee_form.Line_Manager_Staff_No.value=" . oci_result($sqlListings, "Gc_Staff_Number") . ";checknumber('Line_Manager_Staff_No','displayusername');'>" . oci_result($sqlListings, "Surname") . ", " . oci_result($sqlListings, "Forenames") . "</a>"; } } } // Set output to "no suggestion" if no hint were found if ($hint == "") { $response="No user found."; } else { $response=$hint; } //output the response echo $response; ?> On a side note, is there a way I can change it so that the search will present any users based on their first name, as well as the surname?
View Replies !
Optimizing Search Query For Millions Of Rows
I have mysql 4.1 and Im having a difficult time optimizing this query. select domain, length(domain) as len from domains where length(domain) <= ཌ' and not (domain regexp '[[:digit:]]') and domain not like '%-%' and price > Ɔ' and price < ཌ' and end > ��-12-01' order by end ASC, len ASC The following query outputs: | id | select_type | table | type | possible_keys | key | key_len | ref | rows | extra | ------------------------------------------------------------------------------------------------------------------------------------- | 1 | SIMPLE | domains | ALL | end | NULL | NULL | NULL | 2600000 | Extra where; Using filesort | My indexes are: ID - PRIMARY, Unique domain - Unique end Is there anyway this query could be optimized anymore? With only 2.6 million rows its taking a 5 or 6 seconds. It looks like its not finding the right keys.
View Replies !
Multiple Search Fields - Resulting Sql Query?
How would I implement a search in which there could be multiple inputs to search against? For example i have a client database which i need to search, the search form has 2 inputs FirstName and Surname. If the FirstName is populated and the Surname is not populated my search would be: SELECT CustID FROM customers WHERE FirstName='$FirstName' If the Surname is populated and FirstName is not populated my serach would be: SELECT CustID FROM customers WHERE Surname='$Surname' If both fields are populated the serach would be: SELECT CustID FROM customers WHERE FirstName='$FirstName' AND Surname='$Surname' How would this be implemented?? Do I need to create a search for each possible situation and then control which one is used by an if statement - i'm guessing not as that would very long winded for a longer example such as searching by address which may have 5 or more input fields, any of which may be populated. If its relevant i'm using PHP also.
View Replies !
FullText In Boolean Mode Search Query Missing Results
I have this search query that I originally put together from a mixture of tutorials but I’m not sure that it’s working correctly. Secondly, if I change the search to “Leeds United” or try anything in quotes it fails and the same if I try a string. Thirdly, it would just be good to get some professional eyes over it to see if it can be improved. Code: ....
View Replies !
SELECT Search Query - Table Join Required? Help Please!! (PHP + MySQL)
I have a search form that has: - drop down with states (nsw, vic etc) - drop down with all business categories (retail, commercial etc) - keyword / postcode field (2000, or 'builders') The user gets results returned from the business table filtered by state (mandatory), which category is selected (mandatory) and by keyword (optional) or postcode (optional). If keyword / search phrase is given then it will do search of the keywords fields of the business table (has already been indexed) in the selected category only. If postcode it will return all businesses in that category in order of distance from the given postcode. I have 5 tables (additional fields ommitted): 'state' state_id, name 'businesses' business_id, keywords, name, postcode, state 'postcodes' fromPostcode, toPostcode, distanceKMS 'categories' category_id, name 'business2category' business_id, category_id Please dont thing i'm just pawning off my work here!! Basically, i've got this working already, but only just, and in a very long and convulted format. Its far too long to post here, but since i'm not fully versed in table joins, i've been searching individual tables (e.g. SELECT *,MATCH AGAINST etc), building arrays, searching arrays again, and then building results at the end to fit into the paginator. Now the search is taking too long to perform, and i need a leaner alternative. not to mention theres way too many lines of code, and i just know theres a better way. There must be a very simple way to achieve the following searches using table joins, can anybody please help me with 3 search examples below so i can try to understand joins better? Search 1: State + Category only Search 2: State + Category + Keyword Search 2: State + Category + Postcode If there is no postcode, the others still need to display the data filtered by distance from a default postcode of 2000. I'd really appreciate if anybody has a few minutes free to help out here, and hopefully teach me something about effective table joins and searching. I've omitted the extra fields and tables from the real structure, and just left the relevant ones above - if theres anyhing missing or not making sense please let me know and i'll fix up asap.
View Replies !
I Have A Search Form To Search Through The DB.
I have a DB with 50,000 entries. I have a search form to search through the DB. If the recno=30123456 and you search the recno, you get that one file. what if i want a query that searches alll recno's that contain 30?? Can I do that using mysql or do I need to program that in my java app?
View Replies !
Search Field Names / Column Names In Tables
This isn't a problem just wondered if someway it was possible to search through all the tables in your selected database to find all tables which include a given field name. Quiet often when I'm new to using a particular database with loads of tables in it, I find it time consuming to either draw a table model of the database or trapse through the tables trying to find the particular fields. I know you can query table names i.e. show tables like '%search_term%' so is there any easy way of doing something like this: show tables where column like '%search_term%
View Replies !
|