Degrading Sub Select Query To Work In MySQL 4
I have the following query working as intended in MySQL 5. However, I had not realised that the target server is running 4.0.2 and it's not possible to upgrade.
SELECT
records.player_id,
records.record_id,
records.game_id,
records.updated,
game_modes.mode_title,
records.record_time,
players.firstname,
players.lastname,
players.nickname,
players.country,
teams.team_title,
classes.class_title,
tracks.track_title,
games.game_title,
games.version,
record_types.type_title
FROM games, records, classes, teams, tracks, record_types, players, game_modes
WHERE
records.record_time = (
SELECT MIN(record_time)
FROM records
WHERE records.player_id = players.player_id
AND records.game_id = 1
AND records.mode_id = 1
AND records.track_id = 1
AND records.class_id = 5
AND records.type_id = 1
GROUP BY records.player_id)
AND
records.track_id=tracks.track_id
AND record...................
View Complete Forum Thread with Replies
Related Forum Messages:
Cant Work Out Correct Select Query For ..
mysql> select * from parent_cat; +-------+----------+----------+ | catid | pname | psection | +-------+----------+----------+ | 1 | Trainers | Men | | 2 | Bags | Woman | | 4 | Boots | Woman | | 5 | Fragance | Men | +-------+----------+----------+ 4 rows in set (0.00 sec) mysql> select * from categories;; +-------+---------------------------+---------+------+ | catid | catname | section | pid | +-------+---------------------------+---------+------+ | 1 | Nile | Men | 1 | | 2 | Bags | Woman | 2 | | 4 | Boots | Woman | 4 | | 6 | Air Force I & II Trainers | Men | 1 | | 7 | Adidas Trainers | Men | 1 | | 8 | Timberland Trainers | Men | 1 | | 9 | Lacoste Trainers | Men | 1 | | 10 | Gucci & Hogen Trainers | Men | 1 | | 11 | D&G Trainers | Men | 1 | | 12 | Prada Trainers | Men | 1 | | 13 | Chanel Trainers | Men | 1 | +-------+---------------------------+---------+------+ and the following query: $pid = $_GET['catid']; $query = "SELECT categories.catid, categories.catname, categories.pid FROM categories, parent_cat WHERE categories.section = 'Men' AND parent_cat.catid=categories.pid AND categories.pid = '$pid'"; At the moment the query only returns all categories.catname when my categories.catid = 1, but returns nothing if it equals something else?
View Replies !
Reformatting Email Address To Work On SELECT Query
This is probably basic, but so far I cant find any articles about this. I want to "SELECT * FROM dbase WHERE emailaddress = $email;" $email is a feed from PHP, and will contain a string like "some.one@someplace.com" Apparently with $email as a normal string, it gives an error saying: "You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '@someplace.com)' at line 1" I reckon it's the dots and the @s that terminate the syntax and making it not work. How can i get out of this problem? Is there any function I can call to solve this? Or probably a little bit of more programming?
View Replies !
Mysql 4.1 Inner Select Dosen't Work
I have in my home mysql 5 and in the server mysql 4.1 The follow select works fine in my computer but not on the server -------------------------------- SELECT id FROM table1 WHERE name in (SELECT name FROM table2) -------------------------------- when i type it in the server i get 1064 error and no explanation...
View Replies !
Cannot Get MySQL Query To Work In .asp
I have a MySQL database and in the front-end software I am using to Run MySQL, I have created a query on the tables which runs in the front-end, similar to the MS Access query grid. I now wish to pull this query on-line using .asp, but I seem to have found out that I can only pull data from tables in MySQL? ....
View Replies !
SELECT `*` Not Work On New Server
I wrote some code a long time ago that used SELECT `*` from blah blah blah. I'm building a new server with a new installation on MySQL 4 and for some reason this piece of code wasn't working. I looked into it, and turns out only SELECT * not SELECT `*` works on this new server. Now I realise this is probably my crappy coding, but is there some variable I can turn on/that is different between the servers that makes this happen? I've used this code on loads of servers and never had a problem, and would rather not go through all my code fixing this error
View Replies !
Cannot Get Select Statement To Work
I can't for the life of me figure out why my select statement will not retrieve the data from MySql. it is a very simple statment; mysql_query ("SELECT pub_type, call_number, pub_author, pub_title, subtitle, edition, publisher, publication_year, physical_description, series, isbn, holdings, subjects FROM library WHERE id=" .$pub_id); but when I try to echo any of these variables I get nothing showing for results. the $pub_id displays because it is set by a GET function. echo "<b class='foo'>$pub_id $pub_author $series </b> "; I use a select statement on the page that calls for this page and it retrieves info from the database not problem... my includes for database connection, etc are all in tact.
View Replies !
What Query Would Work For This?
I have two tables: say Yes and No. Yes(ID, YesEmail, EmailOwner); No(ID, NoEmail); Both YesEmail and NoEmail contain email addresses. What query can retrieve all the email addresses in Yes table that are not listed in No table? Thanks in advance.
View Replies !
Query Wont Work
PHP Code: if(mysql_query("UPDATE users SET referer_score=referer_score+1 WHERE userID='$frommysql_referer'")) { die(mysql_affected_rows()); im trying to figure out why refer_score isnt being iincremented as im expecting it to. i know that the value of $frommysql_referer is the right value that im expecting it to be. just it wont increment referer_score. and mysql_affected_rows() wont print anythnig to the screen
View Replies !
Query Doesn't Work With Mysql4
Can someone tell me what's wrong with the mysql query below? It does work on mysql 5 but gives me an error with mysql 4. SELECT rev_profile_indiv. * FROM rev_profile_indiv, rev_profile_kids_indiv WHERE 1 AND reviewing IN ( 1, 0 ) AND active IN ( 1 ) AND contract IN ( 1 ) AND UNIX_TIMESTAMP( DATE( rev_profile_kids_indiv.birthdate ) ) >= UNIX_TIMESTAMP( ��-12-15' ) AND UNIX_TIMESTAMP( DATE( rev_profile_kids_indiv.birthdate ) ) <= UNIX_TIMESTAMP( ��-12-15' ) GROUP BY rev_profile_indiv.username ORDER BY lastname LIMIT 0 , 30;
View Replies !
What Do I Need To Do To Make This Query Work?
I must've been working too long hours this week, as my flow of ideas has come to a complete stop. Its really quite simple: 2 tables - bookings , invoices These two counts gives me precisely what I want PHP $unpaid_bookings = mysql_result(mysql_query("SELECT COUNT(id) FROM bookings WHERE invoice_id = 0 AND client_id = $id AND status != Ɔ' AND finish <= '$time'"),0);$total_bookings = mysql_result(mysql_query("SELECT COUNT(id) FROM bookings WHERE client_id = $id AND status != Ɔ' AND finish <= '$time'"),0); so I present this in a ratio, $unpaid_bookings / $total_bookings... awesome now, when I try and flip the coin and show unpaid invoices over total invoices, it all falls apart once I have more than 1 booking per invoice. First i'll explain the table structure. Each booking has a column `invoice_id`, which is assigned to the primary `id` of the invoice table. So one invoice might be associated with x bookings. PHP $unpaid_invoices = @mysql_result(mysql_query("SELECT COUNT(i.id) FROM invoices i, bookings b WHERE i.id = b.invoice_id AND b.client_id = $id AND i.is_paid = Ɔ'"),0);$total_invoices = @mysql_result(mysql_query("SELECT COUNT(i.id) FROM invoices i, bookings b WHERE i.id = b.invoice_id AND b.client_id = $id"),0); Again so it works fine when 1 invoice is associated to 1 booking, but when 1 invoice is associated with say 2 bookings, the invoice count will return two instead of one. The worst part is, I know exactly why (because there are two bookings for the invoice), I just can't get around it! I've tried all sorts of joins, group by's, and i'm not having any luck. I'm trying not to be weak and add the client_id into the invoice table,
View Replies !
Query Does Not Work On Some Server Instances
query: Select * From Students Where C_Name = "XXXXXX" WHen I run this query on 2 of my computers, the result returns no rows. When I run this query on a remote machine hosted by 1and1, with a copy of the same database, the query returns the correct row. The syntax is identical.....
View Replies !
Query Which Gets Rows Based On A Radius, Lon And Lat Doesn't Work?
I have found this query which gets rows based on a radius. I need this for zip codes based on lon and lat's. $sql2 = "SELECT * FROM table as z WHERE (SQRT( (69.1 * (".$userLat." - z.lat)) * (69.1 * (".$userLat." - z.lat)) + (53.0 *(".$userLong." - z.lon)) * (53.0 *(".$userLong." - z.lon))) <= ".$userRadius." )"; return $sql2; $res = mysql_query($sql2, $connDB) or die(mysql_error()); $row = mysql_fetch_assoc($res); based on a test zip code gives a result like SELECT * FROM table as z WHERE (SQRT( (69.1 * (52.399834 - z.lat)) * (69.1 * (52.399834 - z.lat)) + (53.0 *(4.840762 - z.lon)) * (53.0 *(4.840762 - z.lon))) <= 100 ) the lat and lon of the test zip code are right. As you can see z.lat and z.lon don't get any value. And these would be every lat and lon in table. In my db table lon and lat are decimal(10,6) type with a default value of 0.000000
View Replies !
MYSQL Select Query
I am new to MYSQL.I am stuck with building a MYSQL Query. I have two tables X and Y Table x column1 Id Table Y Column1 column2 ID Monday-Sunday i need the ids which has saturday and sunday in the table Y.
View Replies !
Mysql Select Query Help
i am working with a shop script that i have inherited and i want to add the ability to have products in multiple categories. To do this i have created an extra field in the product table called cat_id_2. Now on the list products page I have the follwing call at the moment, which pulls all of the products for the current category... $sql = "SELECT pd_id, pd_name, pd_price, pd_author, pd_thumbnail, pd_qty, c.cat_id, c.cat_description, c.cat_name FROM tbl_product pd, tbl_category c WHERE pd.cat_id = c.cat_id AND pd.cat_id IN $children AND pd_status=1 ORDER BY pd_name"; I tried to change this myself and added the extra paret to the WHERE clause and came up with this... $sql = "SELECT pd_id, pd_name, pd_price, pd_author, pd_thumbnail, pd_qty, c.cat_id, c.cat_description, c.cat_name FROM tbl_product pd, tbl_category c WHERE (pd.cat_id = c.cat_id OR pd.cat_id_2 = c.cat_id ) AND pd.cat_id IN $children AND pd_status=1 ORDER BY pd_name"; But for some reason, instead of putting a product in two categories it puts the same product in the category twice, - its wierd. Can anyone see anything wrong with what i have tried?
View Replies !
How To Use Previous Select Query Results In New Select Query?
I have tested everything and it works OK in its current form. However, what I need help with is the part of the query highlighted in red. As it currently stands, the PHP while statement loops through the rows and echos out the html. The issue I have is that it echos out the same speaker name and subject type for each iteration. Now I know this is happening because I have set subject.event_id = 1, so what I need is to use the event_id of the current iteration as the clause and that is what I need help with....
View Replies !
Create MySQL Select Query From The A Field Using SUBTRING_INDEX
Is it possible to create a MySQL query to do the following. Extract from TABLE.field, which is defined as text, containing either NULL, number (e.g. 54) or range of numbers (e.g. 70-95). Then use the extracted number within a WHERE clause I have looked into using something like SELECT SUBSTRING_INDEX(table.field, '-', 1); Problem is I don't know how to use this within the WHERE clause.
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 !
Work In MySql
This query works fine in SQL Server, will it work in MySql? SELECT a.total, b.browsertotal, b.browser, (b.browsertotal / a.total) * 100 AS browserpercent FROM (SELECT Count(id) As total FROM MyTable) a, (SELECT count(id) as browsertotal, browser FROM MyTable GROUP BY browser) b I dont have MySQL and I am trying to help someone out.
View Replies !
Getting PHP & MySQL To Work Together
I am trying to get PHP to write into MySQL database. Right now it does not seem that it is doing such, MySQL doesnt appear when I bring up the PHPInfo() page. I have removed semi-colons before the Mysql.dll extension in php.ini, and I have made sure that PHP is in the windows PATH. What else do I need to do to get this stuff running?
View Replies !
Getting MySQL To Work..
I downloaded version 4.1.7, opened the manual, followed the instructions, and installed it. Then, when I opened up the "MySQL Server Instance Config Wizard", I set it all up. I press the "Configure" button, and it runs up the point where it creates the Service. Then, it gives this message"Could not start the service MySQL. Error: 0". I've ran a Google search on the error message, but have found nothing. I'm running Windows XP. If there's any more information you need about my computer setup, go ahead and ask.
View Replies !
MySQL Doesn't Work In XAMPP
Ok i downloaded xampp, which has php,apache and mysql all in one, but mysql doesnt work... but ne way when i type my localhost i get the xampp screen which must mean that apache is working fine but what do i do now? im really confused between mysql and apache.
View Replies !
MySQL To Work On My Localhost
I am doing my first web site in PHP after having developed countless sites w/ ASP and Access. I am running Windows XP Pro on my laptop with IIS 5.x I believe. THe web site I am going to be revising is on an Apache server I believe. I say I believe as the hosting company reps. don't speak English and are not so co-operative. So what I intend to do is to fully develop the site on my local host with the intent of then transferring it over. Are there anythings I MUST know before going this route? Also, where do I begin with getting mySQL to work on my localhost? Is it similar to Access whereas I just dbl click a file and it opens a nice handy application like access to work in the tables, etc?
View Replies !
MySQL Join Does Not Work
please take a look a this query: select * from predmeti p, rjesenja r WHERE p.predmetID = r.predmeti_predmetID As you can see, here I want to display content from table predmeti and rjesenja. But only if there is a foreign key in rjesenja. This works fine, it shows the desired results, but.. the vise versa version: select * from predmeti p, rjesenja r WHERE p.predmetID != r.predmeti_predmetID does not work, here I want to display all from table predmeti, but only if there is no foreign key in table rjesenja.
View Replies !
FIND_IN_SET Doesn't Work In MySql 4.1.9
I need some help with FIND_IN_SET function. I'm not able to use this function in MySql 4.1.9 but in MySql 4.0.x I can !!! I've installed the latest version of EasyPhp. When I use a SQL request with FIND_IN_SET it doesn't succed!!
View Replies !
MySQL Tabs Work
Environment | Start Check | Server | my.ini Setup | Err File | Variables | Process | Databases | Report What are the main ones, and what am I supposed to do in the main ones?
View Replies !
MySQL Admin Backups Won't Work
I’m using MySQL Administrator and MySQL Query Browser and want to make a backup of a database. First you click on the “New Project” button and name the project. Next the documentation for MySQL Administrator says… “To choose the databases and tables that will be backed up, select the database from the schemata list and click the > button. Once the database is in the Backup Content list, you can un-check specific tables that you do not wish to back up. “ That sounds straight forward enough – it works like every other gui out there. The problem is you click on the database you want to backup and it doesn’t become highlighted and when you click on the”>” button, nothing happens. Why?
View Replies !
Mysql Server Wont Work
i am having mysql install with Plesk 7.5 for windows and yasterday the mysql server wont work everytime i click to start it stop in same sec how can i solve the problem and did that will make m elost my db ?
View Replies !
Phpmyadmin To Work With Mysql. I Get No Privileges
I have the Fedora version from the Wiley book on Linux. I am having problems with getting phpmyadmin to work with mysql. I get "No Privileges" when I try to create a database. All I see is a test database. I don't see a "mysql" database. I think something did not get installed correctly in the initial setup. Every time I try to grant privileges, change passwords, I get access denied. I am logged in as root. Can someone provide instructions on initial setup of mysql or point me to a script I can run that will set up the mysql database for me?
View Replies !
Setting Up PHP And MySQL To Work Togather.
I can't get MySQL and PHP to work. I've installed MySQL ver.5.0.3 or so on my PC (winXP) on my D: drive, after that i've installed Apache2 serv. also on the D: drive and afterward came PHP5 as a Apache module. I've tried testing if it works. Code:
View Replies !
Setting UP MySQL To Work With Dreamweaver And PHP
I'm trying to set up Dreamweaver to work with PHP and MySQL but cannot get Dreamweaver to recognize my database. I currently have PHP running under Microsoft IIS on my Windows machine and MySQL installed and running. I'm accessing it through MySQL Administrator and also MySQL-Front and don't have any problems connecting to the database in either of these programs. I've set up a DSN for the database, under ODBC Data Sources, and I'm using a virtual directory under IIS for the web pages I'm developing. When setting up a database connection though in Dreamweaver, I get an error message that says "An unidentified error has occurred" As far as I can tell, I have MySQL set up for Root access and also anonymous access. Any suggestions about what I'm missing to get this to work?
View Replies !
Select Within Select Needed To Get This Query Going?
I'm not sure how to go about this, but I am thinking I need some sort of a select query within a select query to get this properly displayed... My table structure is as follows (simplified, of course): payment_id | member_id | completed | amount | trans_added and I am trying to get the following data out of the table - a daily sum of all the transactions that were 1) completed, 2) by a member who already has an existing completed transaction (completed = 1) on a different date (or members with a count of all completed transactions > 1 will be included only). so far I've got this query, but I don't know where/how to plug in the condition for the members/completed/etc: .....
View Replies !
Getting Dreamweaver 8 To Work With MySQL: The "Unidentified Error"
I set up MySQL on my Macintosh at my job (G4 / OSX 10.3.9) 3 days ago, along with PHP -- all went fine, & I got MySQL started, a DB set up -- until I tried to connect Dreamweaver to it I go to connect to the DB in Dreamweaver 8, and when I try to set up the DB in the "databases" tab and click on the "database" field I get : "An unidentified error has occurred" Code:
View Replies !
Mysql 4 Vs Mysql 5? Why Does This Not Work In Both?
$search = "SELECT ct_vehicles.id,". " ct_vehicles.description,". " ct_vehicles.price,". " ct_vehicles.manufacturer,". " ct_vehicles.new,". " ct_sites.county,". " ct_images.id,". " ct_images.vehicleId". " FROM ct_vehicles". " LEFT JOIN ct_sites". " ON ct_vehicles.siteId = ct_sites.id". " RIGHT JOIN ct_images". " ON ct_vehicles.id = ct_images.vehicleId". " WHERE (".$where.")" " LIMIT ".$offset. ",".$rowsPerPage.";"; $where = my condition set (this is correct i think) $offset = Offset set by my paging alongside Rows per Page $rowsPerPage = As above; In mysql 5 it displays the correct 35 records where as in mysql 4 it displays some 13000 records WTF. SELECT ct_vehicles.id, ct_vehicles.description, ct_vehicles.price, ct_vehicles.manufacturer, ct_vehicles.new, ct_sites.county, ct_images.id, ct_images.vehicleId FROM ct_vehicles LEFT JOIN ct_sites ON ct_vehicles.siteId = ct_sites.id RIGHT JOIN ct_images ON ct_vehicles.id = ct_images.vehicleId WHERE (ct_vehicles.description LIKE '%red%' OR ct_vehicles.manufacturer LIKE '%red%' OR ct_vehicles.colour LIKE '%red%' OR ct_vehicles.text LIKE '%red%' ) LIMIT 0,5;
View Replies !
SELECT Query.
Table 1 3 #1,#2 2 5 #2,#3 3 3 #1,#2,#3 4 4 #4 5 5 #1,#2,#3 6 5 #1,#2,#3 7 4 All 8 3 #1,#2,#3 Need to compare the value of field2 with the occurrences of "#" in field3. Tried this: $query_plcResultsSet = "SELECT * FROM Table WHERE RteType IN ('Mainline', 'Connector') AND StartDateD = '$strchvarval' AND (field2 = 'All' OR " . substr_count(field3, '#') . " = field2)";
View Replies !
SELECT Query With IN(...)
I have a query SELECT id, name, text FROM text WHERE id IN (11,22,1,34,56,13,21,19,3,6,9) I need result sorted as in 'IN ()'. But it is always sorted by id. How can I achieve it
View Replies !
Can't Use Select...IN Inner Query
I'm trying to make the following SQL query and keep getting errors: select * from mytbl where reportid in (select reportid from mytbl where level>60) I get this error: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'select reportid from mytbl )' at line 1 When I'm running the inner query (select reportid from mytbl where level>60) it is running OK. Also, when I'm running without inner query (select * from mytbl where reportid in (1,2,3)) itis running Ok. But Somehow I can't run it together. I'm using MySQL 4.0.14.
View Replies !
Help With SELECT Query
I am having trouble coming up with the proper SQL that will get me a certain result. i have a table that looks something like this: request_id | member_id | Club_id 1 | 10 | 12 2 | 10 | 12 3 | 10 | 142 4 | 10 | 142 5 | 10 | 72 I am trying to come up with a query that will give me the number of times that member #10 chose each different club. ex: club #12 - 2 times club #142 - 2 times club #72 - 1 time i have tried a few things but everything i have tried with DISTINCT, or COUNT gives me 5 (total requests). And it is late in the day and my brain is a bit fried.
View Replies !
Using LIKE In A Select Query -
I am trying to query 2 tables. One has a field, County_name which includes a list of counties and the state they are associated with ie. MT-Missoula The other table is a list of sites and has a State field. I would like to bring up a list from the County_names field that begin with a State that matches the value in the Site State field. I can't figure this out, can anyone help a new mysql user? $countyresults=mysql_query("SELECT ct.*, s.State, s.Site_ID FROM county_tbl AS ct, site_tbl AS s WHERE s.Site_ID='$ID' AND ct.County_name LIKE 's.State%' ORDER BY County_name");
View Replies !
Need Help With A SELECT Query
I have two tables. Table 1 = ContentWords Table 2 = TitleWords The tables have both each two fields named wordId and articleId. The wordId field references a wordId in a table named Words which contains the fields wordId and word. As you might understand I use these tables (ContentWords and TitleWords) to index words that appear in articles to use with a search function. It's easy to construct a search query to have it select a articleId from either ContentWords or TitleWord (SELECT articleId FROM ContentWords/TitleWords WHERE wordId = $var). But if I want to search if a word exists in both the Content and Title? I've constructed a SELECT query that kind off works: SELECT ContentWords.articleId AS ContentArticleId, TitleWords.articleId AS TitleArticleId FROM `ContentWords` , `TitleWords` WHERE ContentWords.wordId = TitleWords.wordId AND ContentWords.wordId = $var AND TitleWords.wordId = $var This will output something like: ContentArticleId TitleArticleId 53 76 77 76 That means the word exists in the content in article 53 and 77. The word also exists in the Title in article 76. What I actually want is only ONE field named ArticleId with the result of 3 rows (53,76 and 77). Is this possible? Thanks in advance!
View Replies !
Select Query Help Please
The below query works well for returning 1 result however I now need to expand it to return multiple results. At the moment I feed it 1 car type and 1 company id and it spits out one result, I then loop the query to get the number of results I need - but this is very inefficiant so I want to change it so I pass all my variables at once. So where I have cars.type =Ƈ' I want to have car.type =Ƈ' or cars.type=ƈ' which in itself works but how to I extend the company section as when I add the extra 'Or's' in there the query goes wacky and spits out hundreds of results which are all the same - I think its something to do with the inner join but im not sure. MySQL SELECT prices.single_f, prices.return_f, prices.vehicle, resort.company_id, resort.resort, cars.type, cars.description, cars.long_description, cars.image, surcharges.type, surcharges.adult, surcharges.kids, prices.timefrom, prices.timeto, prices.resort_id, cars.min, cars.max, company.is_enabled FROM prices INNER JOIN resort ON resort.id = prices.resort_id AND resort.company_id = Ƈ' AND resort.resort = 'Acoteias' INNER JOIN company ON company.id = Ƈ' INNER JOIN cars ON cars.type = prices.vehicle AND cars.type = ƈ' LEFT JOIN surcharges ON surcharges.resort_id = prices.resort_id WHERE prices.break <= ďb' AND company.is_enabled = 'Yes' AND ( ( prices.timefrom <= prices.timeto AND prices.timefrom <= ཁ:00:00' AND prices.timeto >= ཁ:00:00' ) OR ( prices.timefrom >= prices.timeto AND prices.timefrom <= ཁ:00:00' AND ན:59:59' >= ཁ:00:00' ) OR ( prices.timefrom >= prices.timeto AND ༼:00:00' <= ཁ:00:00' AND prices.timeto >= ཁ:00:00' ) ) LIMIT 0 , 30
View Replies !
|