Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




Row Select In Old Mysql Versions


We are using MySQL version 4.0.20-standard.

Our application requires a query to do a row select. From what I have found this version does not support rownum. We are unable to update the version of MySQL. Can anyone give us some support.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Benchmarks Of Runtime Versions Of Mysql Or Other Sql Versions Sqlite Hsqldb
mysql vs sqlite vs hsql

First of all i'm on a win32 platform using java. I also have mysql
installed. My question isabout benchmarks and multiple inserts &
selects
SQLITE: http://www.sqlite.org/
HSQL: http://hsqldb.sourceforge.net
I current have a mysql database of approx. 80mb.
Each day I Insert approx .5mb of new records into this table,
and I might also run mutiple Update, Delete, and Select queries as
well.
I'm trying to get an idea of how fast a sql database engine will run
given that is is inside of the JVM. I know it's going to be slower
than a db engine written in C and that's a trade off for being
portable to different operating systems.
What I want to know is how much of a trade off though - I don't want
to have to wait 10 mins or deal with screen freezing... Right
now on a windows platform using mysql things move really fast.
Can anyone give me an idea of the time delay needed to do these
Inserts in HSQL (ie: how much does the jvm slow things down)..
Thanks in advance

MySQL Versions
I am using MySQL 5 on my computer but the web-hotel I am contemplating to use only use MySQL 4.0xx. Can I use the database without modifying it? Or do I need to "convert" (downgrade) it for MySQL 4.0xx? If so, how do I do that?

Running Two MySQL Versions
Actually what I want to do is remove 4.1 because I downloaded 5.0 and installed w/o removing the previous version. I now have port 3307 for 5.0. Is this a problem and how can I change it back to 3306 so e.g. when I use Apache/PHP evrything works?

Two Versions Of Mysql On Same Unix Box
I have mysql 3.23.58 version running on my unix box. I installed a new application on it which need mysql version > 4.0 so I thought of having two mysql versions running on the same unix box. I have first installation in /usr/local/mysql and I untared the new version in /var/local/mysql-standard-4.1.18-pc-linux-gnu-i686-glibc23.

I am following instructions given in http://dev.mysql.com/doc/refman/4.1/en/multiple-servers.html I also created a empty file and named it as mysql.sock.new and stored it in /var/local. When I try to start this new version from /var/local/mysql-standard-4.1.18-pc-linux-gnu-i686-glibc23 using ./bin/mysqld_safe --datadir=/var/local/mysql-standard-4.1.18-pc-linux-gnu-i686-glibc23/data & it says "A mysqld process already exists". Please tell me where I am going wrong and how to configure it properly?

Running Two MySQL Versions
It seems that my computer is running two different mysql versions. When I'm trying to login to the database it refuse my password and giving me access to the test configuration. This is what i get in the event viewer.

Do you already have another mysqld server running on port: 3306 ?
Event id 100.

The problem occur when I changed my password for the database. I have turned off Mysql in local services but i think that that's the original version. When I start the xampp i think it starts the winmysqladmin version (not sure). How do I reconfigure the hole thing and how can I see what's running on my machine.

I actually have another question to. I'm trying to run and open the shell mysqladmin which doesn't work. It's just a flash, which one of them am I supposed to run?? You have several options like mysqladmin, mysql, mysqld, mysqld-nt....etc. I opened the winmyslqadmin which i think wasn't that good.

Downgrade MySQL Versions
I need to move a MySQL database created with MySQL 4.1.22 on PHP 5.2.3 to a different server with MySQL 3.23.58 on PHP 4.3.8.
Is it possible to convert the database to do this?
Alternatively, is there a way to export from the newer version in a format that the older version will accept?

Can Run Two Versions Of MySQL In Windows 2000?
I have been running 4.0.13 for several weeks now and though I'd like to =
test 4.1.0. 4.0.13 is under c:MySQL. I downloaded 4.1.0 under c:4.1 =
AlphaMySQL. When I try to launch mysql it brings me to the old =
version, how do I access the new one without killing the old one? (I =
have also tried putting 4.1.0 on a totally different machine and linking =
to it also.)

Previous Versions Of MySQL With XAMMP
I've downloaded XAMPP for Linux 1.5.1 for use on Fedora Core 4. I notice it only has the latest version of MySQL on it. I'm working on two web sites (for different clients) and they are hosted on different shared Linux hosting servers (with PHP), each with different versions of MySQL available, i.e:

MySQL 4.0.25-standard
MySQL 3.23.52

Is it possible for me to use older versions of MySQL with XAMPP? Could I just turn off MySQL in XAMMP and just run and older version of MySQL independently of XAMMP? If I can then how would I install multiple versions of MySQL in Fedora Core 4?

Symlinking Between Different Serveurs And MySQL Versions
I have a hosted server where we have both web and intranet share a same database. For interne reasons we need to migrate the intranet onto one of our servers and keep the web on the hosted server.

We will thus have the database splited in two. Our intern server willl have MySQL5 and our hosted one will remain with MySQL3.23.39 at list for a while longer.

I would like your advises on the faisability of using symlinking to access the tables on the hosted server from our intern server, knowing that MySQL version are different. The tables on the hosted side are MyISAM.

The main idea is to avoiding using replication to access comon tables on remote servers.

Utility To Convert Between MySQL Versions?
My webhost downgraded from mysql 5 to 4 and I'm seeing errors in the forum I was running. All I can see that would have changed and given me this database error would have been this downgrade. Is there a conversion utility availaible that can change back and forth between MySQL versions? I've looked around for about an hour thru Google and on this forum, but I haven't found anything yet.

I was getting password errors, but we seem to have resolved that issue, and now I'm left with this database connection error.

Thanks for any assistance!

P.S. The errors I get are:

Warning: mysql_error(): supplied argument is not a valid MySQL-Link resource in /home/clanloc/public_html/forum-old/db/mysql4.php on line 330

Warning: mysql_errno(): supplied argument is not a valid MySQL-Link resource in /home/clanloc/public_html/forum-old/db/mysql4.php on line 331
phpBB : Critical Error

Could not connect to the database

Selecting Correct Versions Of MySQL
I have searched this forum and google to try and get a comprehensive answer to this question but i haven't found anything yet.
I am looking to select the correct versions of MySQL, Apache and Php so that they all work together. I notice that there are alot of issues with various different versions sets being chosen and there seem to be instances where it can be very problematic if the wrong one is chosen.
I am looking to use InnoDB and would like to use the latest versions of everything as possible but it doesn't really outline anywhere what works with what best. There are lots of cases that outline what can be problematic but i'm trying to avoid this if possible and find what isn't problematic.

Trouble With NATURAL JOIN Between MySQL Versions
I have this query which works perfectly well in MySQL 5, but doesn't work in 4.1.
I know there were some changes made to join syntax between the versions but for the life of me I can't figure out exactly what I need to do to fix it:

SELECT Status, UserName, FontName, FontPath
FROM AccountInfo
NATURAL JOIN AccountPrefs, Templates.Fonts
WHERE AccountPrefs.HeaderFont = Fonts.FontID
AND UserID = '$userID'
works fine in v5, but in v4.1 I get the old "Column 'UserID' in where clause is ambiguous".
I'm trying to match the UserID in AccountInfo and AccountPrefs, I just left the font thing in there as well because I'm not sure if it's contributing to the problem.

Alternative To Group_concat For Early Versions Of Mysql
Is there an alternative to group concat, if you are using a lower version of mysql. If any one has any ideas it would be great, currently my code (thanks to some one from these forums) looks like this.

SELECT c.clientID, group_concat(ci.interestID) as interests
FROM Clients AS c
JOIN ClientInterests AS ci ON c.clientID = ci.clientID
GROUP BY c.clientID
HAVING find_in_set(1, interests)
AND find_in_set(3, interests)

Is there any way of doing this on a lower version of mysql?
Is it possible to wirte a function similar to group_concat?

How To Detect If Different Mysql Versions Are Installed/runing
from my InnoSetup setup :) I need to detect if any version of mysql is runing on my windows. Others sugested to check fo a mutex or a Class Name(dont know what are these) or Windows Names or Look for a mysql*.exe, so is there something common for mysql starting with v3 .. v5? I mean what is the thing that i have to search for, to know at least if mysql is runing.

For mysql v3 there are the posible runing files:
mysqld.exe
mysqld-max.exe
mysqld-max-nt.exe
mysqld-nt.exe
mysqld-opt.exe
or on Win98 only winmysqladmin.exe?
For mysqlv4 .. im not sure yet
For mysql 5 seems to be more simple, only
mysqld-nt.exe

Do I have to search for all these files(and others that I dont know yet :) ) to be sure that its not runing?

Migrating A MySQL Db From Plesk Over To CPanel - Possibly Differant Versions Aswell ?
Hey all. As title, i had hosting on a plesk server, but was migrating everything over to cPanel due to a better package.

Ive run into some problems though, mainly due to differant versions i think. Anyone know of a way around this as it would be alot of work redoing the whole sites again

Versions
I have MySQL 5.0.24 installed on a XP Pro SP2 PC. The latest version is 5.0.41. I looked at the change logs and they say they are bug fixes only. Have there been any security issues with 5.0.24 that I should be aware of? Do I need to move to 5.0.41 to be safe?

Run 2 Versions
Is it possible to run both
MySQL 3.23 and
MySQL 5,
at the same time on the same machine with php4.3.0 and apache 1.3.27?
What should I consider ?

Two Versions
I wanna run MySQL 3.23.54 and MySQL 5.0 in the same Redhat Linux 9 box at the same time. Is it possible?

Differences Between Versions
We have two versions of mySQL running; version 4.1.15 on a couple of local machines under Windows XP Professional and our public database running 3.23.58 under Apache.

I was populating a new field in our members table based upon a match to a table called region using the following query

UPDATE members,region set members.FPosition_Id = 19
where region.Region_Commodore_Id > 0 and
region.Region_Commodore_Id = members.member_Id

The query ran fine locally (ver 4) but gave a syntax error on version 3. Is there a list of differences/updates between these two versions? Does version 3 not support update queries using multiple tables?

I tried parenthasizing the where statement but that made no change.

Versions Of AMP On Windows?
I am somewhat concerned that i have the right versions
of AMP on my Win XP system so it will all work together...
Is there some link that (in simple terms!) tells which versions are safe
together?

I currently have MySQL version 4.0.20d, with Apache 2.0.52 and php
4.3.10. Is this the best combination?

Two Versions On Same Machine
I had MySQL 4.2 - working fine. I saw version 5 is now stable so I downloaded and installed but did not run it (I think!). Carried on with 4.2.

Then one day MySQLAdmin and Query would not log me on. I checked via the cmd line utility and when I typed in the password the window dissappeared!

I opened MySQLAdmin again and reconfigured the log-on o 3307 (I remember this was default when I installed 5.0). OK, the server must be running. So keep with 5.0 as I managed to restore one of my schemas. I wanted a later version which is only in the 4.1 directories and copied it across BUT 5.0 does not see it. But when I go to stop and restart the 5.0 server in Admin as soon as I go to the server tab to do this it stops automatically! AND will not restart.

Comparing Versions Of Sql
I'm taking up a new position and have never used sql before although use
and code in lots of other languages. When doing a bit of survey I find
many many versions of commercial and public versions of sql. Can anyone
tell me if the syntax is generally similar or are they completely
different. If I invest time learning mysql on XP or Linux will that be
useful if I end up using something like Oracle later on? The only one I
would avoid is MS.... like things that work occasionally.

Removing Old Versions
I loaded a new version of Mandrake Linux 10.0 CE and have also installed and dowloaded a new version of MySQL 4. I'm not sure but think I have several versions installed and running ...

How can I check to see what is installed, what is currently running, and then perhaps remove them all and start by installing single new copy?

Compatibility Between Versions Of SQL
Hi! Would like to enquire if different versions of SQL are compatible to one another.
I've done some code in PHP and which requires access to MySQL on my server. I have tested it on localhost and everything worked fine. Hence, i decided to upload both my code and the database i created to the server. That's when the prob started. I received this msg while trying to view my page:

Could not connect to database: Can't connect to local MySQL server through socket '/tmp/mysql.sock' (111)

what this is about? For info, my MySQL version on my personal computer is 5.0 while that of the server is 3.23. Are the database compatible?

Comparing Versions Of Sql
I'm taking up a new position and have never used sql before although use
and code in lots of other languages. When doing a bit of survey I find
many many versions of commercial and public versions of sql. Can anyone
tell me if the syntax is generally similar or are they completely
different. If I invest time learning mysql on XP or Linux will that be
useful if I end up using something like Oracle later on? The only one I
would avoid is MS.like things that work occasionally.

How To Keep Trace Of The Versions From A Table
From the Code that is been written below i need to keep trace of the versions that are been read from the file(test1.lst) each time it is been changed.Does anyone know as to how i can store it in diff tables(version_0701151004 version0701151100,version_0701161000 ....versionYYMMDDHHMM) each time when this query is been called? n how to keep trace of the date and time ?

or maybe is there any other method where i can store diff versions in diff files ? would be gratefull for any advice

--DROP TABLE stocklist_values;

CREATE TABLE stocklist_values(
SAG_FREIGABE INT(1) NOT NULL,
SAG_SNR VARCHAR(50) NOT NULL,
SAG_NAME VARCHAR(40),
GSM_RELEASE_VON VARCHAR(20));

LOAD DATA INFILE '/home/user945/database/test1.txt' INTO TABLE stocklist_values FIELDS TERMINATED BY '&'


Moving A Database Between Different Versions
I'm trying to move a database on a server with MySQL 4.1.19 to another with MySQL 4.0.27. Is this possible? I'm getting errors when trying to import the database.

XAMPP And MAMP Versions
I'm running an XAMPP version of mysql on a PC and the MAMP version on a Macintosh.
I just realized that I needed to change a couple of tables.
Can I change them on the MAMP version and then copy the appropriate files to the XAMPP version, and expect them to work?

Which files should I copy over ... .MYI, .MYD or both?

The MAC version is 5.0.19
The PC version is 5.0.27

I use Navicat to modify my tables on the mac and do not have this product for the pc.

Import Export With Different Versions
I am hosting a WP site locally on my computer, to test it before putting it online,
Now I have the hosted WP site online & ready to go, but I am having trouble loading the backup data from my computer into it.
When I go to import in the myPHP section, it gives me an error message of:
Import failed, You probably tried to load too big a file.
But the file is only 350kb! The max is 8Megs!
Double checking, it looks like the 2 databases are different versions. Would this be the problem?
If so, how do I go about downgrading the version on my computer? And once done, how would I transfer my posts & info onto it?

Compatible Versions Of Software
MySQL, Apache and Php are a fairly common trio from what i gather .... but there can be alot of problems getting them to talk to each other.

Windows And Linux Versions
I would like to know what are the main differences between windows and linux versions of this DB system.

I´m using it on linux but i´m planning to migrate to windows...

Is there any performance difference? Is it as solid as linux version? It´s of free use (under GPL) ?

I made a test here in windows and it seems to work well..

MySql: Select Database And Perform Mysql Dump
I currently have a batch file created using shell which runs mysqldump and saves the information to a file. However, I was wondering if there would be a way to use a recordset instead to select the database and initiate the mysql dump.

Ideally this is what i would like to have:
rs.Open "Use database mysqldump  > C:", conn, 3, 3

Does anyone know if this is possible?

SELECT INNER JOIN Performance VS Single Table SELECT
I have designed my database using a somewhat oriented approach. Rows are objects, and different type of objects are in different tables, but since my objects share a common set of fields like ExpireDate, Archived, Draft, CreateDate, CreatorID, etc; I have an 'objects' table with these columns, and I have set up a foreign key in other tables where there is a need for a row-to-row integrity.

Now my question is, since I have to SELECT using INNER JOIN with object and the corresponding table, merely to filter out archived rows, I am wondering if I would be better off actually putting the common fields into each respective table and get rid of the 'objects' table altogether. I mean, is it more job for the server to actually JOIN the tables for each SELECT versus having a clean design with object oriented approach ?

How bad is my design, and what are the recommendations of experts who obviously were tempted to create an object oriented database design?

MySQL 4.1 SELECT LIKE '$$$%'
Does anyone know if there is a program (for windows) that can help us catalog our sprocs and table setups into source control?

Mysql Select
I'm trying to make a search script I have a table of keywords that looks like this:

+---+ ---------+
| ID | WORDS |
+---+----------+
| 1 | select |
+---+----------+
| 1 | mysql |
+---+----------+
| 1 | help |
+---+----------+
| 2 | help |
+---+----------+
| 2 | test |
+---+----------+

what I want to do is if you search for mysql and help it will bring back id 1 how would I make a select statement to do that? or is it not possible?

Sub Select With MySQL 4.1
I have upgraded to MySQL 41. and 5.0 and cannot get MySQL to return
the correct results from my database. This same query works correctly
with MS-SQLSERVER.

I have started both 4.1 and 5.0 with the --new function just to be
sure, but I have been told that MySQL does support these statements.

select bookings.key1,bookings.surname,bookings.firstname, bookings.bookingseqno,
bookings.filetype from bookings where bookings.bookingseqno in
(select bookingseqno from bookingcharacteristics where
bookingcharacteristics.chartype=1 and
(bookingcharacteristics.charvalue = 2)) and bookings.bookingseqno in
(select bookingseqno from bookingcharacteristics where chartype=2 and
(bookingcharacteristics.charvalue = 3)) order by bookings.key1,
bookings.bookingseqno

It does not return an error, just ALL records, and I know there is
only 1 record that qualifys to be returned.

Are there other switch settings that need to be changed or set in
MySQL?

Mysql Select Where
i have a directory of websites in different categories. when visitors search for some keyword, i have to search for it in titles, descriptions of websites.

the sql query is:
$sth = mysql_query("SELECT * FROM cb_urls WHERE title LIKE '%".addSlashes($keywords)."%' OR description LIKE '%".addSlashes($keywords)."%' ");

this query seaches all websites in all categories. but i would like to search in only a particular category. i have stored that category in a string $category. now i want search results only in that particular category.

Select Max - From DB2 To Mysql
I am having the following syntax in my current application using DB2 and I need to move it to MySql. How would it translate in Mysql:

SELECT VALUE(MAX(INTEGER(SERVICE_LINE_NUMBER)),0) FROM SERVICE_INFO WHERE BATCH_ID = 1 AND PAGE_ID = 1

I tried Select Max(S_L_N).... but it returns null. If there is nothing I need it to return 1.

Mysql Select
I want to select from a date field records with 1 hour interval.

Mysql SELECT
I have a little problem that i seem to be at a loss at solving efficiently. Here's the situation

table : order_status_tracking
cols : id (int), orderId (int), newStatus(int), date(date), time(time)

each time an order gets a new status there is a row inserted in this table. now i have to generate a table that would get the last inserted status between a given date for an order. i am getting stuck at getting the correct status from the data.. i get the correct id, orderId, date but not the status.. it shows me the first status in the rows selected based on the date criteria.


SELECT MAX(ost.id) as ostId, MAX(ost.date), ost.newStatus, o.serviceType FROM order_status_tracking ost INNSER JOIN orders o ON (o.id = ost.orderId) WHERE date >= $sDate AND date < $eDate GROUP BY ost.orderId



i can't do a MAX on o.newStatus as the max id is not always the last status selected. what happens is that if there are multiple rows for an orderId, it selects the *last* id, *last date*, but the *first newStatus* from that last.

Mysql Select
How do i write a query to say

Select * from table Where DateColumn has dates not before 5 days ago

I can't seem to find out
I need to be able to write the query in a way that the 5 could be replaced with any integer (becasue it's apart of a php script)
bassicaly it's to "pretend" to delete rows that are a certain number of days old. But I want to keep the rows in the database for archive reasons, but the inpage query needs to act like they're deleted.

MySQL 4.0 - Select MAX While Joining
I have three tables categories, authors and books.
Categories is the type of Category as the name suggests.
Authors contain the name of the authors and books table contain the name of books with prices.

Now i want to select the MAX price in a Category be it of any author.
I dont want to use subqueries as for some reasons I cant use MySQL 4.1 or greater and have the MySQL 4.0 version.

Also each author has many books say 100 each.

Using subqueries would make it dam simple but i cant use that.
I also found a new way at the following page but it is significantly slow :
http://dev.mysql.com/doc/refman/5.0/...group-row.html

The method posted by Csaba Gabor is right but is slower.

Is there anyway to solve this problem
I need it urgently for my college Library



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?


MySQL Select Issue
Okay, my table is setup like so:

carId int(11)
carName varchar(50)
category varchar(50)

Now, A field in it would be like this:

1
BWM
IMPORTS

Now in phpmyadmin and my scripts.

SELECT * FROM cars WHERE category='IMPORTS';

It pulls up 0 result where there are about 200. it makes no sense.

My phpmyadmin version is 2.6.4-pl2 .

Mysql Select Formatting
I am a total newbie to mysql and I have been trying to educate myself.  

I created a database and a table within it called "simple", see below.

I loaded data in to "simple" from a tab separated file.

The table simple has the following types -

mysql> describe simple;
+--------+-------------+------+-----+---------+-------+
| Field  | Type        | Null | Key | Default | Extra |
+--------+-------------+------+-----+---------+-------+
| joined | date        | YES  |     | NULL    |       |
| name   | varchar(20) | YES  |     | NULL    |       |
| age    | varchar(20) | YES  |     | NULL    |       |
| sex    | varchar(10) | YES  |     | NULL    |       |
+--------+-------------+------+-----+---------+-------+

If I enter one record in my .txt (tab separated file) and then try and retrieve all records from that table I can see all the data with no problem, see directly below

mysql> select * from simple;
+------------+------+------+------+
| joined     | name | age  | sex  |
+------------+------+------+------+
| 2006-01-01 | bob  | 10   | male |
+------------+------+------+------+
1 row in set (0.00 sec)

If I enter more than one record and then try to retrieve all the data, the formatting goes wrong, where I can't see the whole of the first date and the end of the last field in the first record.

mysql> select * from simple;
+------------+------+------+-------+
| joined     | name | age  | sex   |
+------------+------+------+-------+
 | 006-01-01 | bob  | 10   | male
| 2006-01-02 | tim  | 12   | male  |
+------------+------+------+-------+

If I add more records, the formatting is worse and the joined column makes no sense all the way down.

Select , Count(*) In MySQL
I write the following code in vb6 its work fine for Access and MSSQL but not work with MySQL, RecordCount return -1 always kindly help me..

Dim mms As ADODB.Connection

Set mms = New ADODB.Connection
mms.ConnectionString = "DRIVER = MYSQL ODBC 3.51 Driver;SERVER=10.48.60.183;DATABASE=mms;UID=kma;pwd=abcd
mms.Open

Set rstIWOrder = New ADODB.Recordset

SelectString = "select * from IWOrder where WON ='"
SelectString = SelectString + txtIWO.Text + "'"
rstIWOrder.Open SelectString, mms, adOpenStatic, adLockReadOnly

If rstIWOrder.RecordCount = 0 Then
MsgBox "Internal Work Order not Found in Database"

else

or

SelectString = "select count(*) from IWOrder where WON ='"
SelectString = SelectString + txtIWO.Text + "'"
rstIWOrder.Open SelectString, mms, adOpenStatic, adLockReadOnly

MySQL Select By Datetime?
Just moving my web site ( in ASP ) over to MySQL from Access,

and I'm having trouble with this query:

strsql ="select count(*) from transactions where transactions.BAdateStamper between #" & theMonth & "/" & i & "/" & theYear & " 00:00:01# and #" & theMonth & "/" & i & "/" & theYear & " 23:59:59# and active=1"

was hoping that someone might know what I'm going wrong here,

Php, Mysql And Select Count
I use as the base an existing system, called PHPNuke. My programming work before are only on Assembler, C, C++, Perl and other Databases than MySQL. In PHPNuke and/or the MySQL Queries contained in it there are sequences for simple counting rows (without further processing). The following sequence is permanently used (as example):

$result = $db->sql_query("select * from "$prefix."_sometable where someting='$foo'");
$numrows = $db->sql_numrows($result);

I would make it rather in such a way:

$result = $db->sql_query("select count(*) as count1 from "$prefix."_sometable where someting='$foo'");
$numrows = intval($db->sql_fetchrow($result['count1']));

Now my hopefully not too stupid question. Is there a reason, why e.g. in MySQL large genuine result quantities must be formed, only in order number of lines to determine? I worked so far actually only with other databases. But it is quite possible that that makes any sense here - who knows? Knows here someone the mystery solution?

Mysql Select From Two Tables
I have two tables tb_customer and tb_posts.

I want to select all records from tb_customer, but I also want to have as a column the total number of records from tb_posts with the same ID, the problem is that some of the records in tb_customer, don't have any records in tb_posts with that id.

I got this query, which does almost what I need, except it does not return the results which will have a "post_count" of 0

SELECT c . id , count(p . id )AS post_count FROM tb_customers AS c , tb_posts As p WHERE c . lastdate >0 AND p . customerid =c . id group by c . id ORDER BY `post_count` DESC


Copyright © 2005-08 www.BigResource.com, All rights reserved