>currently, to list the last 100 records in a table I use this sql command:
>
>select * from test order by T desc limit 100;
>Note: "T" is the name of a field in my table "test" .
>
>can I instead use record number or use the count function to get the
>same result?
MySQL doesn't really have the concept of "record number".
>I don't have an index field in my table and the table has no primary
>key for a good reason.
I don't know what the good reason is, but that's also preventing you from
doing what you want.
>
>Also, is this command possible?
>
>select count(*) from table1, table2;
>if it is, why can't I get the correct result:
>
>table1 has 337 records and table2 has 23860 records but the result
>is 8040820 instead.
That's the correct result. You're running a full join on the two tables,
which produces each combination of rows from the tables. 337 times 23680
is 8040820.
Do you mean the sum of the counts of the records in each table?
SELECT @n1 := COUNT(*) FROM table1;
SELECT @n2 := COUNT(*) FROM table2;
SELECT @n1 + @n2;
>
>
>thanks
>--------------------
>Nissim Lugasy
>216-433-2708
>lugasy@stripped>--------------------
--
Paul DuBois, paul@stripped

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.