I am using a query like this on my postgres database,
SELECT TableA.id FROM TableA , TableB WHERE TableA.id = 100;
Each TableA.id is unique (its an autoincrement), I am gettting more than 1 result. Am i missing something in here?
...
I'm trying to develop a sql query that will return a list of serial numbers. The table is set up that whenever a serial number reaches a step, the date and time are entered. When it completes the step, another date and time are entered. I want to develop a query that will give me the list of serial numbers that have entered the step, ...
I have 3 tables of the following structure
products
{
pid
pname
plocation...
}
services
{
s_id
s_name
s_location...
}
txn
{
tid
pid...
}
I am using the following query to get the values I require.
$dbquery = "SELECT DISTINCT prod...
Hi All,
I have a table tilted "tbltree"
Structure:
`id` int(10) unsigned NOT NULL auto_increment,
`title` longtext NOT NULL,
`parent` int(10) unsigned default '0'
Data:
id Title parent
1 abc 0
2 xyz 1
3 pqr 1
4 uuu 2
Now I want the results like this
id title no of childs
1 abc 3
2 xyz 1
3 pqr...
Hey guys,
I have following table structure in my DB
ID Name
--------------------------
ID_1 Name1
ID1 Name2
when I execute the following query
SELECT * FROM tblNames
WHERE ID LIKE '_1'
I get both records selected...
any suggestions how to get rid off it??
...
How do I populate a int column, currently empty, with random numbers with no duplicates?
...
I have a query limited by a date range:
select * from mytable
where COMPLETIONDATE >= TO_DATE('29/06/08','DD/MM/YY')
and COMPLETIONDATE <= TO_DATE('29/06/09','DD/MM/YY')
The table is a log for activities for a ticket system. The content may be something like:
ticket_id|activity|completiondate
1 1 some
1 2 som...
Hi there I got this query string I have to run so I can update a distinct row in a sql server table:
servidorSql.ConnectionString = conexao
Dim insert As String = "UPDATE [Equipamentos] SET [ID_Cliente]=@ID_Cliente, [Identificacao] = @Identificacao, [Fabricante] = @Fabricante, [Modelo] = @Modelo, [Versao_Software] = @Versao...
Hi, I have a problem which I already solved using T-SQL(cursor & loop).(SQL server 2005)
But I am looking for the solution using SQL.
I have a Master Table with a column say MasterRecord(all are unique and type Varchar and PK)
MasterRecord
MRecord1
MRecord2
MRecord3
MRecord4
................
..................
MRecord[n]
Now...
Hi I need small query here are my tables
user table
userid username
user001 987
user002 123
user003 456
logintrack
usrid lastlogin
user001 7/22/2009
user001 7/23/2009
user002 7/24/2009
user001 7/25/2009
user003 7/26/2009
user002 7/25/2009
user001 7/26/2990
Expected Output
userid username lastlogin
user001 987 7/26/2009
...
I need to delete duplicate rows only from the table, like I have 3 duplicate rows in the table, my query will delete 2 rows from 3 duplicated rows.
How can I get this? Please help me.
Thanks
...
I have a SQL server table that has a list of Usernames and a list of points ranging from 1 to 10,000.
I want to display the number of points in my VB.NET program from the username given. For example, if I type in "john" in the first box the program will give me a message box saying whatever amount of points "john" has. I'm not really s...
I've the two following queries:
declare @UserId as int
set @UserId = 1
-- Query #1: Sub-query
SELECT
u.[Id] ,
u.[Name] ,
u.[OrgId] AS Organization,
(SELECT o.[Name] FROM Org o WHERE o.Id = u.OrgId) As OrganizationName,
[UserRoleId] AS UserRole,
[UserCode] AS UserCode,
[EmailAddress] As EmailAddress,
(SE...
UPDATE: I've answered my question below, take a peek and let me know if you have a better way of doing this
executive summary:
when calling my sqlserver function from SQL Management Studio I get a list with results {1, 2, 3}.
when calling the method from a code using NHibernate I get this list {1, 1, 1}. ('1' is an entire result row, ...
I have a database where I check on the size, because clients may only use a certain amount of space, aswell as they may only have a certain number of 'pages', which I put in the db aswell.
I have the following sql query:
SELECT table_schema "Servers",
sum( data_length + index_length ) / 1024 / 1024 "Data Base Size in MB",
sum( data_fre...
I'm trying to export some data from MATLAB to a database. I use a PostgreSQL database via ODBC as follows. First, I create the connection:
dbConn = database('PostgreSQL30', username,password);
If I try to execute some test insertion manually, everything looks fine:
exec( dbConn, 'insert into test(std) values(2.2)')
When I try to g...
Hi all, I need some help to build SQL Query. I have table having data like:
ID Date Value
1 12/01/2009 4
2 12/02/2009 3
3 12/03/2009 6
4 12/01/2008 2
5 12/02/2008 4
6 12/03/2008 5
Here is my query:
select ID, Date, Value from MyTable
where Date between '12/01/2009' and '12/04/2009'
...
I want to query a set of tables based on the column name, type, etc. Basically without knowing the name of a table I want to query the database for all tables capable of storing the data into.
I have this query but I'm not sure if it's very efficient. I was wondering if there is a better way.
SELECT O.TABLE_NAME FROM INFORMATION_SCHEM...
I have a database table that contain two fields "Categories" and "Tags"
i need to create a third field lets say called Keywords as the result of combining both categories and tags
so $Keywords = $tags." ".$categories;
can you help me please on how to achieve this
thanks
...
Hello,
I am using the query builder from Visual Studio 2008 to extract data from an Access mdb ( 2003), but I can't make it to work with a datetime field. When I run it with a third party query app I have works fine, but when I try to implement it into visual studio I can't do it.
What is the correct way to extract last month data?
...