Quick question, I have a table of messages each with a timestamp and a reply_id and a topic_id. Reply_ids can be the same as others, which means those messages are in the same group of replies. When I select a reply_id with the min timestamp, meaning it was the first message of that group, I would also like to know its numbered place wit...
in sql server
begin tran
select * from foos with (rowlock, xlock, holdlock) where id =7
...
commit tran
will lock the row for reading and writing and it will hold the lock until the end of the transaction,
is there an equivalent of this in postgresql ?
...
Okay, so I have a (SQLite) table called log wherein one column (time) is a Unix epoch timestamp (the other columns are irrelevant for my purposes). These are timestamped log entries.
I am trying to get a count of how many items are logged per hour (all-time -- I don't care to do it only for a given day or whatever; I'm trying to get an ...
Hello I have this table structure:
**ProductsTable**
ProductID
ProductName
**CategoriesTable**
CategoryID
CategoryName
**ProductCategories**
ProductID
CategoryID
Each Product can belong to multiple categories. Now I need a way to find Related Products. But I want it in this way:
Let's say Product1 belong to Laptop, Accessories. So ...
What's the preferred method to fetch a subset of records from the database? Use rs.absolute() or Limit?
...
Hey guys, I'm learning OO PHP, and have been looking into PDO -- One thing I'm not clear on though is whether I should be using PDO prepared statements in conjunction with the filter_var() function or just by themselves. For instance, should I be doing
$query = $database->connection->prepare("SELECT name FROM acounts WHERE id = :id LIMI...
I use phpmyadmin, and when entering this adress:
www.mydomain.com/phpmyadmin
a login page appears.
Is there any way of disabling it, so it doesn't appear/exist?
Thanks
...
Hi,
I have two tables i.e.
Users
uid | firstname
1 | John
2 | Bob
3 | Paul
4 | Peter
Calls
cid | assigned_to | caller_id
1 | 2 | 1
2 | 1 | 3
3 | 2 | 4
4 | 4 | 2
assigned_to and caller_id are just the uid in users.
I just want to display the re...
Hi All! I'm using the following query to randomly draw one row from the subset, for each ID1-ID2 pair, of records that have the minimum distance in time (YEAR and MMDD fields).
CREATE TABLE temp4 AS
SELECT *
FROM temp3
GROUP BY ID1, ID2
ORDER BY DATEDIFF( CONCAT(YEAR,'-',LEFT(MMDD,2),'-',RIGHT(MMDD,2)), CONCAT(ID3_YEA...
I have two tables - student and interview - with values:
student
----------
sID
sName
interview
----------
sID
date
outcome = (OFFER, NOOFFER, HIRED)
And I have to list the sID of any student who has never received an offer but who has had more than five interviews.
I am having trouble figuring out how to determine if a ...
I have a table like this:
Item
{
int ItemID
int ParentID
string Name
}
Item is actually a subset of a larger table Object:
Object
{
int ObjectID
string Color
}
So ItemID is an FK to ObjectID. Within Item, ParentID can either refer to another Item or to the parent Object.
What I'd like to do is be able to iterate...
Hi everybody!
I'm developing a windows mobile application which should work in multiple languages (English, German, French, Russian).
This application is about to be shown to customers (Germans, Russians,...) and we would like to generate data depending on the culture it is setup for.
So: has anybody thought of a way to create data w...
Hi! I created a table with this schema using sqlite3:
CREATE TABLE monitored_files (file_id INTEGER PRIMARY KEY,file_name VARCHAR(32767),original_relative_dir_path VARCHAR(32767),backupped_relative_dir_path VARCHAR(32767),directory_id INTEGER);
now, I would like to get all the records where original_relative_dir_path is exactly equal ...
I'm using pyODBS to connect to Oracle database. Connection and executing SELECT query works fine. The only problem is error on UPDATE query executing. I have table:
CREATE TABLE stud
(num NUMBER(6) NOT NULL,
fname NVARCHAR2(70),
year NUMBER(4),
bday DATE,
plata NUMBER(1) DEFAULT 0 CHECK(plata IN (0,1)),
mb NUMBER...
I want to be able to call a query function and based on the results they are put into an object that I can call outside the function. This is what I have:
<?php
function query($sql) {
global $r;
$database = "theatre";
$db_conn = pg_connect ("host=localhost port=5432
dbname=$database user=postgres");
if (!$db_conn): ?>
<h1>Failed conn...
I've created a script called spiralurl (tiny url script). I'm still learning and making changes as I go. One thing I can't get fixed is to check that the user entered url already exists in the database, if it does exist I want output to the user the already shorted url previously created.
Script is at: http://redspiral.net/spiralurl
An...
I´m net very good in explaining this. But i do my best:
I've made a tagging tool for people. Some people contains more then 1 tag, and i need to get those but dont know how to write the SQL query for multiple tag inclusion.
I know you can't write WHERE conditions like this:
LOWER( peoples_tags.tag_id ) = 'outside' AND
LOWER( peoples_ta...
I have a stored procedure that needs to call a 2nd SP multiple times. The only thing that changes are the parameters to the 2nd SP. Something like this:
SELECT @P1=5, @P2=5
EXEC MyProc @P1, @P2
SELECT @P1=0, @P2=1
EXEC MyProc @P1, @P2
Now if it was dynamic SQL I was running I know sp_executesql would be better than EXEC but since...
CREATE TABLE IF NOT EXISTS `mydb`.`MATCHES` (
`idMatch` INT NOT NULL ,
`idChampionship` INT NOT NULL ,
`idWinningTeam` INT NOT NULL ,
`idWLoosingTeam` INT NOT NULL ,
`date` TIMESTAMP NULL DEFAULT NULL ,
`goalsWinningTeam` INT NULL DEFAULT -1 ,
`goalsLoosingTeam` INT NULL DEFAULT -1 ,
`played` CHAR NULL DEFAULT 'Y' ...
I have created a user dsn named "harshi"
To insert rows in a table getting data from Java code I want to insert in SQL table.
The connection statement is:
String url = "jdbc:odbc:Harshi";
Connection conn = DriverManager.getConnection(url,"","");
Statement st = conn.createStatement();
Still I am getting output as:
Got an excepti...