I currently have a database with over 6 million rows and growing. I currently do SELECT COUNT(id) FROM table; in order to display the number to my users, but the database is getting large and I have no need to store all of those rows except to be able to show the number. Is there a way to select the auto_increment value to display so t...
Here is the code I've written to create a scenario:
USE tempdb
GO
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'dbo.Emp') AND type in (N'U'))
DROP TABLE Emp
GO
CREATE TABLE Emp(
EmpID Int Identity(10,1) Primary Key,
EmpGroupID Int)
GO
INSERT INTO Emp(EmpGroupID) VALUES(1000)
INSERT INTO Emp(EmpGroupID) VALUES(1000)...
I have an NSString and would like to get the number of occurrences of a particular character.
I need to do this for quite a few characters, so it would be nice for it to be quick.
In case it makes any difference, it's actually an NSMutableString, and the characters will all be uppercase English letters.
...
This is how things work
I use Wordpress category tables and have 2 main categories. The first one is called "location" and the other one "subject". Both categories have sub categories of their own.
In my example we have "location" category 17 and "subject" category 3.
This is what I want to do
I want to select ONLY the data where BOTH ...
There are 2 columns that I want data from. Basically I want to see new signups per day. Go easy on me, my first day with mysql (or any DB for that matter)
So far I have this
mysql> select created, count(id) from user group by created;
+---------------------+-----------+
| created | count(id) |
+---------------------+-------...
I was thinking of the best way of adding a class of 'featured' (in classic ASP), in this sequence of records from a DB: N,Y,Y,N,N,Y,Y
The sequence is:
2 3 6 7 10 11 14 15 18 19...
I already have a count (starting from 1 going for each record)
Many thanks!
...
In C# i am making a simple text editor with line numbers. I want to count the ammount of valid line breaks in a string.
i want to count
\r
\n
\r\n
How can i do this?
Or better yet, can someone point me to an article on how to line number an rtf box
...
I have a the query:
SELECT availables.bookdate AS Date, DATEDIFF(now(),availables.updated_at) as Age
FROM availables
INNER JOIN rooms
ON availables.room_id=rooms.id
WHERE availables.bookdate BETWEEN '2009-06-25' AND date_add('2009-06-25', INTERVAL 4 DAY) AND rooms.hostel_id = 5094
GROUP BY availables.bookdate
Which returns something l...
Could I run the query:
Select id, (
select count(*) from tableA as a where a.value < a.id
)
from tableA as a where id < 5
and get the results I wanted. If not is there a way to do the same thing without having to do 2 querys?
...
I am building a menu that I want to display in a certain way. However, it is to be populated from a database so it cannot be hard-coded.
Essentially I want the 'li' tags to appear in set places when they are created and was hoping that I could set their class using php count() and already having the css set up for them.
Basically, the ...
HOW TO DISPLAY FIRST AND LAST ROW VALUE FROM THE TABLE BY USING COUNT
EXAMPLE:
ID TIME DATE
001 10.00 02:10:2009
001 02.00 02:10:2009
001 23.00 02:10:2009
002 04.00 03:10:2009
002 12.00 03:10:2009
002 22.00 03:10:2009
SELECT ID, COUNT(*) AS TIME FROM TABLE
OUTPUT IS
ID date TIME
001 02:10:2009 ...
So what I'm trying to do is a bit tricky. I'm trying to come up with a sql query that will be able to return counts for specified time frames. So I have a table 'v'. Here is some basic data from Table v
Table v
_____________
id p_id created_at
1 1 2009-06-09 18:54:17
2 2 2009-06-09 21:51:24
3 2 200...
Hi,
I have the following code
$result = $handle->select()->from('store_products_id', array('count'=>'COUNT(store_products_id.product_id)'))
->where('store_products_id.store_id=?', $this->store_id)
->columns($selectColumns)
...
I am trying to filter an SQL database.
Each row represents a user, the main column I’m focusing on is titled last_visited and formatted as… 2009-06-17 12:15:32.
How many users have visited in the last day/week/month?
Like in:
SELECT COUNT(*) AS USERS_TODAY
FROM parts_users
Where updated_at > (NOW()-7)
...
Hi i have question about iterate throught the Alphabet.
I would like to have a loop that begins with "a" and ends with "z". After that the loop begins "aa" and count to "az". after that begins with "ba" up to "bz" and so on...
Anybody know some solution?
Thanks
EDIT: I forgot that i give an char "a" to the function then the function m...
Preemptive apologies for the nonsensical table/column names on these queries. If you've ever worked with the DB backend of Remedy, you'll understand.
I'm having a problem where a Count Distinct is returning a null value, when I suspect the actual value should be somewhere in the 20's (23, I believe). Below is a series of queries and t...
I have a table which has 32 columns. 2 of these columns are identity columns and the rest are values. I would like to get the average of all these 30 columns, excluding the null ones. If none of the columns were null, that would have been pretty easy as follows
select (val0 + val1 + val2 + ...) / 30
Since I would like to exclude the nu...
Hello
Can anyone tell me which is he better appraoch in MySQL whin it comes to finding the row count of a table: is it better to do
SELECT COUNT(*) FROM TABLE_NAME
or to look up the row count in the table TABLE in the INFORMATION_SCHEMA?
This would be a frequent operation for calculating pagination counts for pages?
I should add t...
I need help converting this query to linq to sql:
select
rd.RouteDispatchID,
r.RouteNumber,
s.ShortDescription Status,
rd.DispatchDate,
rd.CreationDate CreatedDate,
e.FirstName,
e.LastName,
count(md.MachineDispatchID) NumMachines
from
dbo.RouteDispatch rd
inner join dbo.Route r on rd.RouteID = r.Route...
$result = $db_con->query("SELECT SQL_CALC_FOUND_ROWS * FROM users LIMIT 0,10");
$count_result = $db_con->query("SELECT FOUND_ROWS() as totalcount");
$row = $count_result->fetch_assoc();
$total = $row['totalcount'];
$total keeps returning 0 even though the $result contains all the user rows in it.
ini_set("mysql.trace_mode", "0");
I...