help to make query work on version 5.0.51a

can someone help me make this query work on version 5
it was working fine on version 4, but now it gives me the message
#1054 - Unknown column 'massage_charge.patient_id' in 'on clause'

, massage_schedule.finish
, massage_charge.service_date
, massage_charge.amount
, massage_charge.tip
, massage_patients.first
, massage_patients.last
, massage_patients.ES
, massage_patients.massages
, massage_patients.date_created
, massage_schedule.finish
CASE WHEN DATE_ADD(massage_therapists.hire, INTERVAL 90 DAY) > CURDATE()
THEN CASE WHEN massage_schedule.finish = 60
WHEN massage_schedule.finish = 90
WHEN massage_schedule.finish = 120
WHEN DATE_ADD(massage_therapists.hire, INTERVAL 180 DAY) > CURDATE()
THEN CASE WHEN massage_schedule.finish = 60
WHEN massage_schedule.finish = 90
WHEN massage_schedule.finish = 120
WHEN DATE_ADD(massage_therapists.hire, INTERVAL 6 MONTH) = DATE_SUB('2008-09-03',INTERVAL 6 DAY)
AND massage_charge.service_date

Posted On: Thursday 25th of October 2012 10:49:03 PM Total Views:  247
View Complete with Replies

Related Messages:

mysql help, query hangs   (210 Views)
SELECT,a.dateid,a.ticker, case when a.close-(select b.close from hist b where a.ticker=b.ticker and b.dateid=a.dateid-1 ) > 0 then a.close-(select c.close from hist c where a.ticker=c.ticker and c.dateid=a.dateid-1 ) else '0.0' end from hist a where a.dateid > 3568;
Slow MySQL query - please help   (130 Views)
Hi Guys! I have a mysql query that is running very slow and is causing my page to take forever to load. The "dt_parked_stats" table has over 40,000 rows. Is there anyway to speed this query up PHP Code: selectdt_derived.*,format(revenue/clicks,2)asrpc,format(clicks/uniques*100,2)asctrfrom(selectdt_parked.*,sum(dt_parked_stats.uniques)asuniques,sum(dt_parked_stats.clicks)asclicks,sum(dt_parked_stats.revenue)asrevenue,sum(dt_parked_stats.net_revenue)asnet_revenuefromdt_parkedleftouterjoindt_parked_statsondt_parked.domain=dt_parked_stats.domainanddt_parked_stats.datebetween"2010/01/01"andnow()groupbydt_parked.domain)asdt_derivedorderbydt_derived.domain
need help with simplifyling mysql queries.   (308 Views)
ok im really not sure what this is called so im making a new thread. in my current website i need to select photos using 3 different mysql calls, is there a way to simplify them into one mysql call there are 3 types of photos i need selected and they are related to the current photo and "report" thing, so far i have been doing it this way: Code MySQL: "SELECT id FROM photos WHERE seq > :seq and reportid=:reportid and seq NOT LIKE '0' ORDER BY seq ASC LIMIT 1"; "SELECT id FROM photos WHERE id < :fotoid and reportid=:reportid ORDER BY id ASC LIMIT 1"; "SELECT id FROM photos WHERE seq=( SELECT MAX(seq) FROM photos WHERE reportid=:reportid) and reportid=:reportid ORDER BY ID ASC LIMIT 1"; but now i started wondering if its a bit excessive and could be possibly simplified into 1 mysql query
MySQL not working - Need help ASAP!   (308 Views)
My site has suddenly gone completely down due to a MySQL error! Please help... My php scripts give this error: Warning: mysql_pconnect() [function.mysql-pconnect]: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11) in /home/morthian/public_html/_scripts/connect.php on line 9 Fatal error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (11) in /home/morthian/public_html/_scripts/connect.php on line 9 phpMyAdmin shows this: #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured) , Alright, nevermind this. The problem seemed to have fixed itself. Something must have malfunctioned on my host's server. (It lasted for quite a long time though.)
Need help excluding certain terms from database search.   (176 Views)
Hi folks -thanks for any input. I'm running a MySQL database client version: 3.23.58 The database contains a lot of comic strips and is designed to be searchable by keyword (among other things). Each strip's record contains keywords related to its content, and it also includes a list of every character who appears in that strip. However, I want to restrict people from searching for specific keywords, for example "George", because searching for the word George would bring up nearly all of the strips in the database, as George is in almost all of them - something we're hoping to avoid. With thousands of records, it wouldn't make sense for me to remove all instances of George from the keywords field, either. Here's the way my query is presently structured. I capture the keywords from an input form, trim the whitespace and then run the query. Code: $query = "select * from table where description like \"%$trimmed%\" order by date"; This works well to let people search for the terms we want to allow, like "flower", "flowers", "flowering", but I want to refuse to let people enter "George", "Georg", "orge" etc. and having every George-related strip show up. I started experimenting with if statements to deny the search based on the value of %$trimmed%, but as you can see this gets problematic quickly especially for characters with longer names. There's got to be a better method. Code: if ( $trimmed == "George" or $trimmed == "george" or $trimmed == "eorge" or $trimmed == "orge" ) { echo "Generate message denying the search"; exit; } Any ideas
help with this Select statment...   (171 Views)
I have a mysql error help please PHP Code:
help in sql query :) please   (209 Views)
hello , i have two tables; first table is 'thread' consist of columns id , title,status second table is `comments` consist of : id,threadid,status i want sql query to fetch all data from first table for each row stored in it but by condition , fetch only rows from first table but which have comments stored in second table and comments.status='0' .. so if comments.status for the thread is 1 , don't fetch this thread data wait u m
syntax help for query   (101 Views)
I am not quite sure of the syntax required for the following: I have 3 different categories of advertising types, represented by a field name called "category" in the database with a value of 1, 2 or 3. I would like to pull out the last item from each category using the field "dateAdded" I can do what I require with 3 separate queries, an example of one as follows but I am sure this can be done in one query. If it can, I would really appeciate the syntax to do so. Code: $query = "SELECT * from advertisements WHERE category=1 ORDER BY dateAdded desc LIMIT 1";
sql statement works but takes forever - can anyone help?   (246 Views)
I have the following sql statement: Code: SELECT item.item_id, item.itemaction, item.user_id, item.flagged, item.title, user.username, item.thumb, LEFT( item.details, 150 ) AS shortdetails, ROUND( distance, 2 ) AS distance FROM ( SELECT * , ( SQRT( ABS( POWER( ( Grid_E -246818 ), 2 ) + POWER( ( Grid_N -54564 ), 2 ) ) ) ) / 1609.344 AS distance FROM `postcode` ) AS postcode INNER JOIN user ON user.postcode = postcode.postcode INNER JOIN item ON item.user_id = user.user_id WHERE distance
Sound easy I hope someone can help?   (124 Views)
I have a website built on Drupal CMS, it has a blog and forum, but that's really not the real content of my site. I was contacted by Founder/Admin of a major Forum running Vbulletin. The Admin of that forum wants me to integrated my current pedigree database onto his website, can this be done
query help requested   (157 Views)
I am querying three cols of one table. I want to get results like this: Menus -> Continental Breakfast -> Full Breakfast Drinks -> White Wines -> Red Wines the query below is returning only 'menus' and 'drinks' but not the others. Code MySQL: SELECT f.business_id , f.subject , f.file FROM files f WHERE f.business_id = and f.live_from = ( select max(live_from) from files where live_from
SQL Server query help   (166 Views)
I have 2 tables as follows: ------- Table1 ------- ID HeatID1 HeatID2 HeatID3 ------- Table2 ------- HeadID HeatValue If I select * from Table1, I would get the ID and the ID for each Heat, for example (1, 3, 2, 2) Instead of that, I would like to write a query that would return (1, Hot, Warm, Warm), which is the value in the HeatValue field in Table2. I'm sure this can be done, but I'm just not seeing how and it's driving me crazy! Hopefully someone can help me out here.
Query help with distinct   (203 Views)
HI, I have a simple query Code: SELECT DISTINCT alt, galID FROM cfm_gallery LIMIT 12 Which works great, but I also want to add another field to the query photo But I don't want that field to be distinct, how do I do this
IN() query help?   (203 Views)
I have the following tables: links link_id----------link_title----------link_desc 1----------------title---------------long description 2----------------title---------------long desc 3----------------title---------------long desc 4----------------title---------------long desc 5----------------title---------------long desc 6----------------title---------------long desc 7----------------title---------------long desc links_data id-------------link_id----------link_data 1----------------3------------------data 2----------------2------------------data 2----------------7------------------data How do I get all the links (with all the fields) which are found in links_data
need help with a query   (191 Views)
The relevant cols in my table are these. |Session_ID | referer | domain_viewed | (please don't worry about the upper and lower case. this is a test/practice db and I have learned about that issue. ;o I am trying to find out the total number of unique viewers (sessions), who were refered by referer AND who visited domain_viewed My query is like this but it gives seems to give me the total number of visitors referred irrespective of session. Code mysql: SELECT count(*) from tbl_Statistics where referer = '' and domain_viewed = '' group by Session_ID How can I make sure that it returns say a composite result of 4 sessions :: 650 page views (total across those sessions) bazz
Need help with creating a portable application with database.   (176 Views)
I'm planning a portable logbook for employees to replace the current unstable Filemaker Pro one but I've got a few problems from the start. I don't know which database system to use. The project has to meet specific criteria: It is a logbook that stores information in a database and which can be used to produce reports detailing each employee's activity. It must also be: 1. Portable on a flash disk. 2. Easy to set up. Unzipping into a folder and being ready to go would be ideal. 3. Possible to create a backup tool that saves backups of the database from within the application. The frequency of the backups should be controllable and restoring should be easy. 4. Be able to import and export .csv files for integration/migration to and from the existing application. I do JavaScript, PHP, mySQL and general relational database design. I did know some ASP and VB some years ago. (I'm keen on CSS too, but that's icing). Options I've considered: a. MS Access. This would be easy to use since any machine with Access could be used and I could create the database, forms and reporting tools in one package. Cons are it is unstable, dependant on Access version on the machine in question and I don't know how to program it at the moment (I can learn). Even creating linked combo-boxes is hard compared to how easy it is in JavaScript/HTML. b. Portable Apache + mySQL and PHP/Javascript pages. This looks like it has a tough learning curve for me and it doesn't look like it will be easy for the users to setup and use. c. XAMPP and PHP/Javascript pages. You still have the setup difficulties for non-techy users and you have to start and stop services. This will be too much of a headache for the users - they really need something which is double-click and go. d. Online. Users would need net access, which they don't always have. This also means that the host (me) would have responsibility for the data held on my server. The users having responsibility for their own data is far preferable. I'm stumped at the moment. Access seems the easiest option atm but the instability of it is a big problem. Even small projects I've done recently have been prone to crashes (using Access 2007). Has anyone any ideas
Trigger for Duplicate rows (Please help)   (184 Views)
Im creating an employee database for TAFE. I have an employee table with employee_id and place fields. The trigger is activated by the Before Insert event. When there's a duplication of employee_id and place the trigger generates a message. For example if a new inserted row has employee_id 20 place 6, and there is a row with employee_id 20 and place 6 already existed in the Employee table, the trigger generates a message: Duplicate Employee_id 20 Place 6. I don't want a unique constraint. The code is below: Code: CREATE TRIGGER employee_tg ON employee BEFORE INSERT ON employee FOR EACH ROW BEGIN IF NOT EXISTS (SELECT 1 FROM employee e INNER JOIN INSERTED i ON i.employee_id=e.employee_id AND INSERT INTO employee(employee_id,place) SELECT employee_id,place FROM INSERTED ELSE RAISEERROR ('Duplicate employee_id 20 Place 6) END IF; END DELIMITER; Im having syntax problem in MYSQL. What could be wrong
Changing value's, query help.   (185 Views)
I have a table i need to edit i want to replace all values of 3 to 1 within a column. eg. change blah to 3 where blah = 1 just not 100% sure on the right syntax. hopefully someone can point me in the right direction.
Need help with this query...   (169 Views)
I need to know if it's possible to have a query that will select products from the database that belong to a certain store...but if there is no product like it that belongs to that store then use the default store. Here would be the table layout: TYPE PRODUCT STORE 1 CoolProduct Walmart 1 CoolProduct default 2 CoolProduct2 default ... So if I wanted to get all the products with 'Type' of '2' that were from Walmart but if Walmart isn't found then use the 'store' called 'default' how would I do that (This part is actually used within a JOIN statement so I can't just LIMIT 1 and do an ORDER BY deal because I'm actually pulling a number of different 'types' at once...just need to use the default if it can't find a 'store' that matches.)
if else stament error please help....   (179 Views)
hi im still not very well familiar with using if else statements in Mysql can anyone help me i made a query like this Code SQL: SELECT degree_code FROM courses_code this query selects all the degree_code from the courses_code table now what i need to do is to filter it Code SQL: IF degree_code = XXXX THEN degree_code= " " END IF how can i incorporate that code from the first query i tried something like this but it didn't work Code SQL: SELECT degree_code IF degree_code=XXXX THEN SET degree_code = " " #or just put a NULL VALUE END IF FROM courses_code