MySQL Query For PhpBB
i want to display 5-10 latest phpBB2 posts on my homepage, and i know there are mods for the forum's index page that do similar thing, but i want to do it in my Perl script. I know how to connect to mySQL DB, but I don't know SQL.. could someone help me with mySQL query for X latest posts, so I would get the result containing user name, post topic, post date&time and post text?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
MySQL Query Linking OpenCrypt & PhpBB
I understand that this will seem very novice to you all as developers, but I really need some expert eyes on my question because frankly the other forums have offered no real assistance. I have a customer database system called OpenCrypt installed and running on my website. OpenCrypt has built in features to connect to my mySQL database as to create phpBB accounts similtaneously as general website accounts are created on my website! Now. I am new to mySQL and am working on getting the correct syntax to work with my phpBB database. The following are my current fields in question: user_id -> I need these id's to be created sequentially when new rows are added to my table, phpbb_users. user_regdate -> What date parameters does phpBB read? Thanks for your help! This is my current simple syntax used to similtaneously add phpBB rows to the table, where %variable% refers to my OpenCrypt fields: INSERT INTO kylebt_Forums.phpbb_users SET `username` = '%username', `user_password`=MD5('%password%'), `user_email`='%email%'
Help Rewriting A Slow Phpbb Query
I have a "glance" or "Recent Topics" list on my forums that have become fairly complex. I modified an already feature rich glance mod to allow users to select individual forums to exclude from showing topics in the list. As well when users are members of certain forum groups, they see topics from the group forum in the list, and they are highlighted a different colour. The main SQL query to create the list often is showing up in the MySQL Slow_query log and I'm pretty sure is the main cause for the page loading slow. I am no mysql Guru, so I thought I would seek the advice of some to improve or totaly rewrite this slow query. PHP $sql = "SELECT f.forum_id, f.forum_name, t.topic_title, t.topic_id, t.topic_last_post_id, t.topic_poster, t.topic_views, t.topic_replies, t.topic_type, p2.post_time, p2.poster_id, u.username as last_username, u2.username as author_username FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u, " . USERS_TABLE . " u2 WHERE f.forum_id NOT IN (" . $forumsignore . $glance_recent_ignore . ") AND t.forum_id = f.forum_id AND p.post_id = t.topic_first_post_id AND p2.post_id = t.topic_last_post_id AND t.topic_moved_id = 0 AND p2.poster_id = u.user_id AND t.topic_poster = u2.user_id ORDER BY t.topic_last_post_id DESC"; $sql .= ($glance_recent_offset) ? " LIMIT " . $glance_recent_offset . ", " . $glance_num_recent : " LIMIT " . $glance_num_recent; The "NOT IN" list varies per user, but here is an example: NOT IN (77,75,76,25,26,37,63,64,66,67,67,1,25,26,37,70,28,75,76,78)
Phpbb With Mysql
Im going to uss phpbb as my forums but i dont have a clue where to get started. I know i have to create a database with mysql so it can connect, but i need help on how to start the database what should i put in it etc. I think i can use phpadmin, if i'm right. My host provides me with sql database and sql. Can any please help so i can get this working.
MySQL With PHPbb?
Is it enough to just install mySQL on the webbserver for the phpbb-forum to work? Or do I have to create my own database-files with predefined tables too?
Mysql Login Error For Phpbb.
what i am used to do, if i have to select more rows by their id's i write "SELECT * FROM table1 WHERE id IN (1,2,3,4,5)" how can i do this via Execution in adodb (http://phplens.com/adodb/) ? if i pass array, adodb starts complaining, if i implode it, it adds quotes around the string... any help? $ado -> Execute("select * from table1 where id IN (?)", array(array(1,2,3,4,5)) ) //this does not work:(
Help With MYSQL And PHPBB On Server 2003 Standard
Trying to get help with this situation. I have installed PHPBB, PHP (4X) and MySQL 4.1. This is how I started out. 1. Installed MYSQL - ran setup - did FULL install - and entered in new password when requested. MYSQL gave the green light when computer rebooted. Created new database with CREATE DATABASE XXX; Also installed ODBC from MYSQL site and created a "SITE DSN" for the ODBC 2. Installed PHP and verfied working and accessible 3. Installed PHPBB per the instructions on the site. Did the permissions as instructed on config.php and install.php 4. Came to the install screen. Entered the info and password that I did with MYSQL installation (Root was the username) NOW SAYS - CANNOT CONNECT TO THE DATABASE. I do not know what to do at this point.
Phpbb
I am trying to set up PHPbb on my website using MySql 4.1 for my forums and I can't figure out how to create a new database and connect the database to the actual site and also I need to locate my: 1 database name 2 username 3 password
PHPBB Forums
I have MySQL 4.0 installed on my computer. I tried to install the PHPBB forums and set it to MYSQL 4.0, but i dont know a valid host name, or database name, database username, and password. How can i figure these things out.
How To Read Phpbb
php file is loaded as codes on windows, but when u upload it on web u get the codes showed as image and stuff, so my question is, when using local host (windows xp) what prog or how i can see the php files not as codes/source when opening but as image or table or whatever.
Phpbb And Firefox
I am developping a forum using phpbb 2.0.17 (the lastest version). My forum url is www.qnhl.com. The problem is the following: When you make a new post in a specific forum, this forum should show the "new post" icon instead of the "no new post" one. But it's not the case in Mozilla firefox. The "no new post" is always there. What's the problem? Anything related with cookies? Note that I don't have this problem with Internet Explorer.
Phpbb Forum
I'm experiencing some problems trying to get my phpbb forum to work with mysql. I'm running the newest version of apache, and php is installed and working, but I'm not quite sure about what I have to do with the MySQL database part to get it working. If anyone knows of any tutorials or anything I would be grateful Just for reference: I'm a newb when it comes to both php, and MySQL.
Phpbb: Username Already Taken After Deleting
I tested to delete phpbb user where user_post = 0. After deletion, the query exe as normal. But when I start to register, the phpBB immediately shows Sorry, but the username is already taken. instead of showing registeration form.
PhpBB Slow Loading
my site runs quickly except when a user hits forum (allready signed in or logging in) to login to the forums it takes 10x as long to get to the forums as it does the rest of the site, once in the forums its ok and runs as normal,is there any settings in SQL that can speed this up? or is there another problem.
PHPBB Can't Connect To Database
So i'm running Apache, PHP, and MySQL 4.x/5.x (i've attempted both) on Win2k. When i try to install phpBB2 it says it can't connect to the database Connection to database You have not established a connection to MySQL 4.x. ERROR: Access denied for user 'ODBC'@'localhost' (using password: NO) Your database was not found. ERROR: Access denied for user 'ODBC'@'localhost' (using password: NO)
Editing Not Working In PhpBB
After transfering my forum from one server to another, editing stopped working. You can go to phpBB's edit link, but when you try to edit the post nothing is changed. Topic titles can be edited, but nothing else can (including uploaded files with the attachment MOD). If I edit it directly from phpMyAdmin it will work fine, but editing through the forum does nothing. On the last server it worked fine, although I'm pretty sure on my last server I was running on an older version of MySQL (3.x). On my new host (globat) I'm on MySQL 4.1.Nothing was changed in phpBB's scripts since the transfer, so nothing would have taken away the ability to edit post text. If anybody knows what is stopping these things I would greatly appreciate the help, since I've been looking for a solution for quite some time now.
Seprate Database For PHPBB
I have a databse for the main website that will contain ~15 tables. Are there any advantages/disadvantages to merging and seprating and what is generally the best way to go? I'm also interested to hear about (other) situations in wich you would choose for an additional database to increase my insight in the subject.
Tables Import PhpBB/phpNuke
My existing site is ok but limited and I'm now at the point where I would like to use a CMS, but I want to import all the old sites membership and comments into the new install. I HAVE A SCRIPT THAT WILL DO THIS called. phpbb_nuke_conv.tar should anyone else ask. but for this to happen the phpBB data must be in the same database where the nuke data resides, ie moving the phpBB tables over to the nuke SQL database. The prefixes are different so there no problems there, could someone please point set-by-step for this proceedure. I'm sure it only a few buttons and it would save me an ENOURMOUS amount of time reading about a subject I would rather not.
Making Site Login Add Users To Phpbb Database Table
I have a login script for my site that I got off the net and was planning to use, but, I also wanted to make it so that when a user signed up thru the registration form it would also add them to the phpbb database's table. It wasn't discussed heavily from where i got the script but from what was mentioned the encryptions differ which results in a rejected login. Code:
How To Create Efficient MySQL Query From A Pseudo Query
I'm trying to build a webapplication where users can search for a person having a particular preference for color and material. To store this information I use the following structure (a MySQL dump can be found at the end of this post): *table person with fields: -persid: autoincrement id -name: name of the person *table material with fields: -materialid: autoincrement id -material: name of the material eg "wood" *table color with fields: -colorid: autoincrement id -color: name of the color eg "green" *table persmaterial with fields: -persmatid: autoincrement id -persid: link to table person -materialid: link to table material *table perscolor with fields: -perscolorid: autoincrement id -persid: link to table person -colorid: link to table color In the webapplication the search can be entered by the users as a kind of pseudo query: (color=red OR color=blue) AND color=green AND material=iron My question is: how can I automatically transform this pseudo query into an efficient MySQL query? I have tried out some different options: Option 1: (SELECT p.persid FROM person p, perscolor pc, persmaterial pm WHERE p.persid=pc.persid AND (pc.colorid=1 OR pc.colorid=2) AND p.persid=pm.persid AND pm.materialid=2 GROUP BY p.persid HAVING (count(DISTINCT pc.colorid)=2 AND count(DISTINCT pm.materialid)=1)) UNION (SELECT p.persid FROM person p, perscolor pc, persmaterial pm WHERE p.persid=pc.persid AND (pc.colorid=2 OR pc.colorid=3) AND p.persid=pm.persid AND pm.materialid=2 GROUP BY p.persid HAVING (count(DISTINCT pc.colorid)=2 AND count(DISTINCT pm.materialid)=1)) Remarks: *I do not see how to turn a general pseudo query into a query like the one in option 1, except for turning the pseudo query into a sum of products form where the sulms would correspond to the UNIONs. IS there a clever way to obtain such a sum of products form from an arbitrary pseudo query? Option 2: SELECT persid FROM person p WHERE (EXISTS(SELECT * FROM perscolor pc WHERE pc.colorid=1 AND p.persid=pc.persid) OR EXISTS(SELECT * FROM perscolor pc WHERE pc.colorid=3 AND p.persid=pc.persid)) AND EXISTS(SELECT * FROM perscolor pc WHERE pc.colorid=2 AND p.persid=pc.persid) AND EXISTS(SELECT * FROM persmaterial pm WHERE pm.materialid=2 AND p.persid=pm.persid) Remarks: *very easy to get from pseudo query to MySQL query but what about performance? Option 3: SELECT p.persid FROM person p, perscolor pc, persmaterial pm WHERE p.persid=pc.persid AND (pc.colorid=1 OR pc.colorid=2 OR pc.colorid=3) AND p.persid=pm.persid AND pm.materialid=2 GROUP BY p.persid HAVING sum(case when pc.colorid in (Ƈ',Ɖ') then 1 else 0 end) >= 1 AND sum(case when pc.colorid=ƈ' then 1 else 0 end)>=1 AND sum(case when pm.materialid=ƈ' then 1 else 0 end)>=1 Remarks: *this option requires the pseudo query to be turned into a product of sums form; again is their a clever way to obtain such a form; Option 4 SELECT DISTINCT pc1.persid FROM perscolor pc1 INNER JOIN perscolor pc2 ON pc1.persid=pc2.persid AND pc2.colorid=2 INNER JOIN persmaterial pm1 ON pc1.persid=pm1.persid AND pm1.materialid=2 LEFT OUTER JOIN perscolor pc3 ON pc1.persid=pc3.persid AND pc3.colorid=1 LEFT OUTER JOIN perscolor pc4 ON pc1.persid=pc4.persid AND pc4.colorid=3 WHERE COALESCE(pc3.persid,pc4.persid) IS NOT NULL Remarks: *this option requires the pseudo query to be turned into a product of sums form Option 5: SELECT p.persid FROM person p, persmaterial pm,perscolor pc1,perscolor pc2,perscolor pc3 WHERE p.persid=pm.persid AND p.persid=pc1.persid AND p.persid=pc2.persid AND p.persid=pc3.persid AND (pc1.colorid=1 OR pc2.colorid=3) AND pc3.colorid=2 AND pm.materialid=2 GROUP BY p.persid Remarks: *very easy to get from pseudo query to MySQL query but what about performance? -- phpMyAdmin SQL Dump -- version 2.6.1 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: Oct 19, 2006 at 01:13 PM -- Server version: 4.1.9 -- PHP Version: 4.3.10 -- -- Database: `aston` -- -- -------------------------------------------------------- -- -- Table structure for table `color` -- CREATE TABLE `color` ( `colorid` int(11) NOT NULL auto_increment, `color` varchar(30) NOT NULL default '', PRIMARY KEY (`colorid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Dumping data for table `color` -- INSERT INTO `color` VALUES (1, 'red'); INSERT INTO `color` VALUES (2, 'green'); INSERT INTO `color` VALUES (3, 'blue'); INSERT INTO `color` VALUES (4, 'yellow'); -- -------------------------------------------------------- -- -- Table structure for table `material` -- CREATE TABLE `material` ( `materialid` int(11) NOT NULL auto_increment, `material` varchar(30) NOT NULL default '', PRIMARY KEY (`materialid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ; -- -- Dumping data for table `material` -- INSERT INTO `material` VALUES (1, 'wood'); INSERT INTO `material` VALUES (2, 'iron'); -- -------------------------------------------------------- -- -- Table structure for table `perscolor` -- CREATE TABLE `perscolor` ( `perscolorid` int(11) NOT NULL auto_increment, `persid` int(11) NOT NULL default Ɔ', `colorid` int(11) NOT NULL default Ɔ', PRIMARY KEY (`perscolorid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=7 ; -- -- Dumping data for table `perscolor` -- INSERT INTO `perscolor` VALUES (1, 1, 1); INSERT INTO `perscolor` VALUES (2, 1, 2); INSERT INTO `perscolor` VALUES (3, 2, 1); INSERT INTO `perscolor` VALUES (5, 3, 3); INSERT INTO `perscolor` VALUES (6, 3, 2); -- -------------------------------------------------------- -- -- Table structure for table `persmaterial` -- CREATE TABLE `persmaterial` ( `persmatid` int(11) NOT NULL auto_increment, `persid` int(11) NOT NULL default Ɔ', `materialid` int(11) NOT NULL default Ɔ', PRIMARY KEY (`persmatid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ; -- -- Dumping data for table `persmaterial` -- INSERT INTO `persmaterial` VALUES (1, 1, 1); INSERT INTO `persmaterial` VALUES (2, 1, 2); INSERT INTO `persmaterial` VALUES (3, 2, 1); INSERT INTO `persmaterial` VALUES (5, 3, 2); -- -------------------------------------------------------- -- -- Table structure for table `person` -- CREATE TABLE `person` ( `persid` int(11) NOT NULL auto_increment, `name` varchar(30) NOT NULL default '', PRIMARY KEY (`persid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=4 ; -- -- Dumping data for table `person` -- INSERT INTO `person` VALUES (1, 'john'); INSERT INTO `person` VALUES (2, 'emily'); INSERT INTO `person` VALUES (3, 'liz');
How Can I Make A Query Like Microsoft Access, And A Query From A Query
I am new to MYSQL and am trying to understand how to make queries... I am moving from Microsoft Access where it is GUI driven and easy! I can make a simple single query using MYSQL Query Browser, say: qry1: SELECT ID, Area FROM data GROUP BY Area How can I store this as a query inside MYSQL, rather than having to code it each time? In Microsoft Access I could enter a variable ($VARIABLE) and then pass by code to the query: qry2: SELECT ID, $VARIABLE FROM data GROUP BY $VARIABLE How can I store this as a query and then pass the variable from code? In Microsoft Access I could base a query on the results of another query, so following example above: qry3: SELECT qry1.Area, data.ID FROM qry1 INNER JOIN data ON qry1.Area = data.Area; How can I store this as a query in MYSQL.
Different Results In Mysql & Mysql Query Browser?
I've come across an extremely strange problem. The exact same query in both mysql command line client, and mysql query browser gives entirely different results. I was hoping someone out there could shed some light. Ok, the query (I've stripped it bare, the real query is a bit more complex)... Each person in the people table has an associated 'place', which is an integer that maps onto a suburb in the suburbs table. The 'place' CAN be NULL. so, for all intensive purposes, the schema is roughly:
Help With Php/MySQL Query?
I'm trying to pull records from a MySQL database using a sql query - to pull records where the "exp_date" field is greater than or equal to today. How do I do this? Here is my query: PHP $query = "SELECT v_title,link_id,v_descr,hw_added,hw_region_id,approved,user_approved,exp_date FROM ec3_ad WHERE hw_feat=1 AND approved=1 AND user_approved=1 AND hw_region_id=103 AND exp_date>=strftime('%d %b %Y %H:%M:%S') ORDER BY hw_added DESC LIMIT 20"; ... but this is obviously not working because I don't know how to add today's date/time dynamically to the query.
Can Anyone Help With This Mysql Query?
I'm using the following query to join the 3 tables gallery_category, gallery_photos and spectacle: PHP SELECT gallery_category.id AS gcid, gallery_category.name AS gcname, private, COUNT(photo_id) AS countim, spectacle.id AS sid, spectacle.name AS showname FROM gallery_category LEFT JOIN gallery_photos ON gallery_category.id=gallery_photos.photo_category LEFT JOIN spectacle ON gallery_category.spectacle=spectacle.id GROUP BY gallery_photos.photo_category ORDER BY gallery_category.name ASC It seems to work fine, but it will only return 3 rows. If I add a new entry to the gallery_category table, the result from the query doesn't return it. If I then add an entry to the gallery_photos table with the new gallery_category in the column gallery_photos.photo_category (i.e. I add a photo to the new category), then the new category will be returned in my result set. My first thought was that it was ignoring categories with no photos in, but this is not the case (one of the 3 rows returned has no photos - countim=0).
MySQl Query
SELECT * FROM test_downloads, test_download_ride, atm_rides, atm_areas, atm_area_ride WHERE atm_areas.area_id =1 AND atm_area_ride.area_id = atm_areas.area_id AND atm_rides.ride_id = atm_area_ride.ride_id AND test_download_ride.ride_id = atm_rides.ride_id AND test_downloads.download_id = test_download_ride.ride_id I would like to keep the "and" format for the time being instead of using joinsor any other method.
Mysql Query Help
I have 2 tables in my database that I want to link in policy table I have an orgid and a policyid in the policypermissions table I have the permissionid and policy id. my problem is that I have a bunch of duplicate policiepermissions assigned to different policyid's and I want to delete a specific permission id Quote: select count(p.orgid), p.orgid, pp.policyid from policypermissions pp join policies p on p.policyid=pp.policyid where permissionid=7 group by p.orgid Having (count(p.orgid) >1) the count for the orgid is right but I need to see all of the policyids for each orgid. is there a query that I can run that will delete all but the first policyid?
MySQL Query, Is It Possible?
I have the following table-structure: countID countItemCode countIPaddress countWhat (in or outclick) countReferer Is it possible to make a mySQL query that outputs the following #38AFG66 total clicks: 34 (in:12,out:20) referrer (site1:10,site2:12,site3:2) #JHGS676 total clicks: 45 (in:31,out:14) referrer (site1:8,site2:7,site3:5,site4:25)
MySQL Query Help
I am sure you should be able to do this using Join.. but its a tad bit advanced for me I need to get the value of admin and super_admin from the table groups selecting by the column called name. But to get the value to select by the column name you need to get the value of the column called group in the table users selecting by the column called username.
Fed Up With MySql, Can Someone Help Me Run This ****ing Query?
I come from MS SQL 2005 background and I cannot get this MySql query to run.. INSERT INTO [lookup] ([Type],[Key],[Value],Rank,Status,Created) VALUES (1,2,'a',1,1,CURRENT_DATE()); Why won't this run??? (I know type, key, value are MySql "keywords" BUT I use the column definitions []). In MS SQL 2005, this works fine perfectly. Also, how the ***** do I run multiple sql statements in MySql query browser? Which ****** developer wrote it so you can only run one statement at a time? It's these little annoying ****** that make me switch back to MS SQL. Also, how the ***** do you declare variables in MySQL WITHOUT using a ***** stored procedure? Here's what I want to run IN MS SQL 2005: DECLARE @Id INT; SET @ID = 0; DECLARE @ResultDate Date; SET @ResultDate = GETDATE(); Begin IF @ID > 0 BEGIN INSERT INTO User (Name, Created) VALUES ('test', @ResultDate); SELECT @ID = @@IDENTITY; END ELSE BEGIN UPDATE User SET Name = @Name, Modified = @ResultDate WHERE ID = @ID; END SELECT @ID as ID, @ResultDate as ResultDate Try and Convert that into MS SQL (INLINE SQL...not a function, not a procedure, INLINE SQL). Is this possible in MySql? If it isn't, I'm done with open source crapola. People keep talking how Microsoft sucks, but at the end of the day...Microsoft actually has products that get the job done.
MySQL Query
Can someone help me or point me in a way for help coding the mySQL query thing so I can run querys? Do I run the querys on PHP stuff?
MySQL Query Help Please...
How do i select full names from a table which start from any number ? I am having a table named users in which i am simply retriving records by alphabets for eg. All names starting with A or B or C...i am getting this done by using the following: sql = "SELECT * FROM users WHERE fullname = 'A%'"; But i don't know how to retrieve all records which start from 1,2,3,4,5,6,7,8,9,0 all at once. I will all records to be retrieved at once which start from a number or who's first char. is a number.
Mysql Query Log
I have used mysql 5.0 alpha and php to build a shop cart system.I installed all of those in windows. Coz I would like to set up a common query log, so i use "mysqld --log=fileName" to generate a log file。The result is the log file has been successfully generated, but there is nothing inside . For exampe, I run "mysqld --log=test.log" (test.log is the log name given by myself). In the data folder, there is an file called "test.log" has been generated. There is not any log information inside except those general information. Even I have done some searching SQL command not only in the shop cart system, but also in the MySQL command prompt, it seems like mysql never write anything into that log file. I don't know what is going on here or is there something I should do but I didn't do or something else. Please help me. The following are the contents in my log file. That's all of them, no matter how long I wait. -----------------------------------------------------------test.log mysqld, Version: 5.0.0-alpha-max-debug-log, started with: Tcp port: 3306 Unix socket: MySQL Time Id Command Argument
Query Across DBs In MySQL
I'm new to MySQL and am wanting to be connected to the MySQL server and query across diffrent db's. To my understanding a different db in MySQL is the same as a schema in Oracle. Am I correct in this thinking? What I want is to have one DB called projects which has common tables such as contact_details, postal_codes, language and so on. Then a number of other db's for different projects. Then project1 has its own tables but can also see those in the projects db.
MySQL Query
I have a query: $query = "SELECT id, catid, title, description, date, updated, hits FROM #__weblinks " . "WHERE published='1' AND checked_out='0' " . "ORDER BY date DESC LIMIT 5"; In this record, there is a record creation date ("date") and a record update date ("updated"). At record creation, the current date and time is entered in the format "YYYY-MM-DD HH:MM:SS" in the "date" field, and the "updated" field is filled with "0000-00-00 00:00:00". When the record is updated, the "date" field remains the same, but the "updated" field is updated with the current date and time. In my query, it will fetch the 5 most recently added records. I want the query to check if "updated" has a value other than "0000-00-00 00:00:00" and if so use that field to ORDER BY, otherwise use the "date" field to ORDER BY, again, limiting the results to the 5 most recently added OR updated records. I originally tried using a UNION, but this would return duplicate records if a record was both new and updated within the timeframe that separated the top five results. Obviously I need to use an IF or CASE statement in the ORDER BY, but I could get anything but errors when trying. Any ideas?
MySQL Query Help
Anybody know how the following query could be re-written without using the union feature? SELECT vechicle_plate, vechicle_state FROM purchase_info WHERE customer_id = '1' UNION SELECT vechicle_plate, vechicle_state FROM purchase_info, associates WHERE purchase_info.id = associates.purchase_id AND associates.customer_id = '1'
MySQL Query
I'm working on little webapp where one field is set to MySQL DATE datatype. by default this will go to 0000-00-00 which is fine, so I'm wondering if it's possible to have a query that see if the value is the "0000-00-00" and return NULL. select this, that, date FROM table .. if date = '0000-00-00' set date NULL ... or something?
Query In MySQL
I know how to query a query in MSAccess, but do not know how to do this with MySQL.
Mysql Query
Why MYSQL query return empty set ? When there are many rows in user_table where status not equal to 'Deleted' ? $query=" Select * from user_table where status !='Deleted' " However if I look for rows with status equal to "Deleted" MYSQL return correct result. $query=" Select * from user_table where status='Deleted' "
MySQL Query Log
I have huge load on my site because of mysql database queries. I did necessary indexes and make some optimisations on data values. Now I'm tryin "EXPLAIN SELECT" query to find slow queries. But if I get a query log with query times that will be a shortcut to find the problem. Has mysql got a query log and where can I find it? Do you recommend a tool or script to log mysql queries? If I can see on the server that would be so helpful. But I can try on my windows localhost too.
Mysql Query
I would like to select something from a mysql table which started with int (0-9). how ?? for letter I can use "select * from mysql_table where letter like "A%"; or somthing like this"
MySQL Query
I want to find record of all the people whose date of Birth falls in this week i.e 2006-11-27 and 2006-12-04. basically I want to find out Date of Birth falling in current week
Mysql Query
I have two tables: departments & employees. "departments" contains name of department and associated managers & "employees" contains employee name and associated department name. Now to get those departments which have atleast 20 employees, I do the following query: SELECT department_name COUNT(*) as "Number of employees" FROM employees GROUP BY department_name HAVING COUNT(*) > 20; This gives me a list of departments with its number of employees. Can I do anything to fetch the department manager names also from the other table of all those departments returned by above query
Mysql Query.
i have a small staff auction for work. here is the query: SELECT * FROM listing l, bids b, users u WHERE l.listingid=b.listingidAND u.username=b.buyer AND biddate = (SELECT MAX(biddate) FROM bids bi WHERE bi.listingid= b.listingid)AND l.enddate < NOW() + INTERVAL 8 HOUR this is good but some auctions may have many winners in buy now format. so therefore, because of the SELECT MAX(biddate) part, this is just bringing the last bidder (winner) in all auctions. however, its also selecting only one buynow who is the winner too but there are other winners in buynow. in this case, i added this to the query: OR b.format='buynow' Because i want it to select all the buynows as all buynows are winners but then only select the maxdate only for those in the bid format auctions.
MySQL Query
I had a program developed in SQL for a windows application that I want to run on a Linux server. besides the application not physically being able to run on Linux, could I have MySQL on the linux server and have the application write to the tables in linux? also the .sql document gives me errors when i try to use the control center. it has problems with some syntax. my guess is that mysql doesnt like the query or there are no dbo in Linux.
Mysql Query
im currently trying to fix up this query to be more work efffiecent SELECT nextInvoiceDue FROM users_orders WHERE nextInvoiceDue>=NOW() AND currentinvoice IS NULL AND active='1' if the date is before the next invoice duedue and there isn't already a invoice made for that order the row is selected. then after that check if its 7 days or closer to the due date and if so it makes the invoice. to save time i think it would be better to have WHERE nextInvoiceDue is within the next 7 days. i can't figure out how to say that in a query though
MySQL Query
I have a table called "sales"with two fields that I want to use for a calculation and then sum in a MySQL Query. One field is "price", the other is "exchange_rate". I want the sum of all "price/exchange_rate" in the table. I have the following: PHP Code: SELECT SUM(sales.price/sales.exchange_rate) AS total FROM sales WHERE .... What am I doing wrong?
Mysql Query
i have the following query: Code: SELECT SubT.id,SubT.MN,SubT.MX, (SubT.MX-SubT.MN)as diff from (SELECT id, MIN (grade) as MN ,MAX(grade)as MX,DATE FROM grades GROUP BY id) AS SubT WHERE SubT.MN<SubT.MX Order by DIFF DESC Basiclly it should spit out the student and the min grade max grade and difference. When i run it in phpmyadmin it works fine... when i run it in my php script i get the following error: Error message = FUNCTION grade.MIN does not exist
MySQL Query
I have two tables. A 'users' table, which contains an id, name, and email address and a table called 'responses' which tracks responses from users which has an id, userid, response, emailid, and date field. The userid field in the responses table is the id from the records in the users field. When ever I send an email to the users in the database, I insert a blank record into the database for each user I send an email to and I fill in the userid and emailid fields. When the user clicks on a link in the email, they are taken to a page where they type in a response and it is stored in the database. In my admin area, I want to be able to view the responses. Is there a way for me to order the records first by the date in the responses table, but then by the name of the user from the users table?
|