I have a sqlite3 database with one table called orig:
CREATE TABLE orig (sdate date, stime integer, orbnum integer);
What I want to do is select the first date/time for each orbnum. The only problem is that stime holds the time as a very awkward integer.
Assuming a six-digit number, the first two digits show the hour, the 3./4. show ...
Is there anyone can help me to get the logical represntation of a bitmap index and reverse key index?
...
hi,
let say I am developing the transaction base application in c# and asp.net. transaction is of type money and data with sql server database. then how can i manage the scenario in terms of security?
...
I have two tables that are related, which, for the purpose of this question, will be called posts and tags. posts contains various postings, such as those found on a community forum system. tags contains a unique set of tags, that are added when the server encounters a new tag that is not already in the system. There is only one entry pe...
Does using prepared statements in Zend_DB or Doctrine protect me from sql injection?
example:
$stmt = $db->prepare('SELECT * FROM users WHERE name = ? AND password = ?');
$rs = $stmt->execute('peter', 'secret');
Or do I have to check strings and types types myself?
Another quickie: Which of the two is best? I only need the DB abstra...
Hello,
Imagine a simple query:
SELECT name, lastname FROM people
Let's imagine it returns 6 rows. What i need to do is to return a number of rows that ROWS Mod 4 would be equal to 0. So if the query would normally return 6 rows, it should return 2 more rows with NULL for name and lastname. It's easy to count the rows it would return ...
Hi, Is there any way to remove the matching rows from MySQL join Query.
Actually I have two tables where I have store the pub_id, and post_id in both tables these are common.
I want a result when I query all the matching rows from table1 and table2 should not be listed and the non-matching rows should be listed only.
...
Does sql query degrade the performance in iphone App? Join is a good or bad for the iphone app performance.
...
Hi,
I am trying to get the thumbnail meta data for the posts in my wordpress blog together with their category and some other data.
The thumbnail data is serialized and I will unserialize it later.
Here is the query I have:
SELECT wpostmeta.meta_value AS url,
wposts.post_content, wposts.post_title, wposts.post_status, wposts.p...
I am in spree to find a SQL or T-SQL query to get names of all the tables in a Database/Schema which have a column of given name.
Can any one help me in this please?
Thanks in Advance :)
...
Hi All,
I have a table defined as:
create table Foo (
X integer,
Y timestamp,
Z varchar(255),
primary key (X, Y)
);
For a given X I want to find the most recent row. I've come up with the following so far, but would like to know if anyone knows something that will perform better or is just "interesting" such as using ...
I have views which look something like this:
mysql> select * from p2;
+---+---------+---------+
| k | measure | time_id |
+---+---------+---------+
| D | 200 | 2 |
| E | 201 | 2 |
| F | 203 | 2 |
| A | 20 | 1 |
| B | 22 | 1 |
| C | 23 | 1 |
| D | 100 | 1 |
| E | ...
I have following sql query when i execute it zero rows are displayed i have feild called distance with value null in it , when i execute this query the distance feild will be filled with some numerical value but if i specify condition distance<2 or distance <10 or ... same result gets displayed can i know the whats problem.
SELECT Id,...
Hi there. I have 4 tables:
categories - id, position
subcategories - id, categories_id, position
sub_subcategories - id, subcategories_id, position
product - id, sub_subcategories_id, prod_pos
Now I'm doing tests to find out what's wrong with my query.
So i want to select sub_subcategories, and to get someting like that:
[[1,2,3,4,5...
I need review some code of test-application written in PHP/MySQL.
Author of this code wrote three SQL-queries.
I can't understand, if he meant here some performace optimization?
DB::fetch("SELECT COUNT( * ) AS count, `ip`,`datetime`
FROM `logs`
WHERE `datetime` > ('2006-02-03' - INTERVAL 10 DAY)
GROUP BY `ip`
ORDER BY `datetime` DESC...
How to find if a column is used in any insert, update or delete statements in a stored procedure. I used a system query, but was not accurate. Can we check it manually in sql management studio or any query is there?
...
Hi...
I have a table (Cycle)...
Then I create a trigger
**
alter trigger AnyName on Cycles
for insert,update,delete
AS
BACKUP DATABASE medrepcrm TO DISK = N'C:\medrepcrm.bak' WITH NOFORMAT, INIT, NAME = N'pcrm-Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
**
but,when I insert,update or delete in cycle table th...
assume that we are performing search using keywords: keyword1, keyword2, keyword3
there are records in database with column "name":
1: John Doe
2: Samuel Doe
3: John Smith
4: Anna Smith
now Query:
SELECT * FROM users WHERE (name LIKE "%John%" OR name LIKE "%Doe%")
it will select records: 1,2,3 (in this order)
but i want to order ...
Hello All,
I have a confusing little problem in SQL-Server 2005 and Classic ASP. I have the following table in the database
+-----------+----------+----------+--------------+-------------------------+-------------------------+--------------+
| ProgramID | SystemID | ClientID | ProgramName | ProgramStart | ProgramEnd ...
I want to get a list of all the users in the SQL server database and their roles. What I'm trying to do is to find out if certain users have privileges to more than one database. Is there a query which can do this directly?
...