sql

how to add floating numbers as hours give total hours with minutes and seconds

i have simple problem i am having time in double format i.e 1.20 hr. 2.30 hr. 3.40 hr. i want to add them as hours of time not as floating numbers ie to base 60 . for example 1.20+2.30+3.40=7.30 hrs -- correct 1.20+2.30+3.40=6.90 incorrect i want it in both sql and c# , currently i am using custom made function fr both side . i want...

sql: how to update table values from another table with the same user name?

I have two tables, with a same column named user_name, saying table_a, table_b. I want to, copy from table_b, column_b_1, column_b2, to table_b1, column_a_1, column_a_2, respectively, where the user_name is the same, how to do it in sql statement? ...

Query to read a query in a file

I have huge create table queries (100's of Gb) which I'd like to ship throught ODBC to my db (Postgre in that case). The problem is that these queries are built from an external program, so I would like to avoid loading each query in memory to ship it by ODBC to the db. I would much prefer to indicate to the db in a (small) query to go ...

Running .Net Software with a SQL database on other systems ?

I've created a software that is used a SQL database. (With VS2008 SP1 & C#) What do I need to run this software on the other system without installing Visual Studio ? ...

How to Insert row into SQL database with IDENTITY_INSERT set to OFF using WCF services?

An SQL table has auto increment property set for the primary key AnnotationID of INT type. The Silverlight application WCF service code: public void InsertImageAnnotation(int imageId, string imagePath) { DataClassDataContext db = new DataClassDataContext(); ImageAnnotation row = new ImageAnnotation(); r...

MySQL Query Help

I have the following table structures: matches: +-------------------+---------------------------+------+-----+-------------------+-----------------------------+ | Field | Type | Null | Key | Default | Extra | +-------------------+---------------------------+------+-----+-...

Can you compare text alphabetically in a WHERE clause?

I'm using SQLite, and I need to do the following: SELECT * FROM fruit WHERE name<='banana' This statement should return all entries whose "name" column contains text that comes alphabetically before (or is equal to) the word "banana". So it should return the row with "apple", but not the row with "pear" or "orange". It appears that s...

Book Database Data

I am creating a database which will contain information about book. (title, author, description, edition etc). Is there anyway i can download book data from the web so that i can insert in my database. I want database to have between 500 - 1000 books information. The database is in Sql Server. ...

How to perform multiple SQL tasks when using SQL within code (in this case vbscript)

I am hitting a brick wall with something I'm trying to do. I'm trying to perform a complex query and return the results to a vbscript (vbs) record set. In order to speed up the query I create temporary tables and then use those tables in the main query (creates a speed boost of around 1200% on just using sub queries) the problem is, t...

Select only rows that have unique fields

What is an SQL command that checks for rows that have rows with no duplicate fields in them. ex: A A A B B B should not be in the resulting table. Only rows such as A B C D E F i.e. given data like: A A A B B B A B C D E F A A B G H Q Should return A B C D E F ...

Django not cascading on delete.

I'm realizing more and more that I'm still a Django noob, I can't seem to figure out what's happening with my data model and why it's not cascading deletes. Here is my model. class message(models.Model): msg_text = models.CharField(max_length = 9900) date_time = models.DateTimeField() is_read = models.BooleanField(defaul...

Inaccessible mysql table inside subquery

Hello SELECT ka.id, ka.user FROM {auctions} ka WHERE (SELECT MAX(inst) FROM (SELECT SUM(installment) AS inst FROM {payback} kp WHERE id IN (SELECT id FROM {auctions} WHERE user = ka.user) GROUP BY scheduleD...

CouchDB select all where field contains value

Is it possible to select all documents where a field contains a value. i.e is the following sql possible? Select * FROM table WHERE field LIKE %substring% ...

Ideal database for geo (map) data

I'm looking for suggestions for an ideal database or data structure for storing a map. Essentially, the map consists of "ways" which are like roads, paths, etc. Ways contain nodes (which have a latitude and longitude coordinate, and sometimes an altitude.) Any such database or structure: should be able to locate all the nodes in a bo...

How do you connect to a recently create postgres database?

I am just learning sql and starting with PostgreSQL. Here is what I am trying to do: psql postgres CREATE DATABASE newdb; Then I want to do something like this (in the same psql session) CONNECT DATABASE newdb; Of course this doesn't work. But after doing the statement I should be able to do something like: CREATE TABLE newtable ...

Is there any point using MySQL "LIMIT 1" when querying on indexed/unique field?

For example, I'm querying on a field I know will be unique and is indexed such as a primary key. Hence I know this query will only return 1 row (even without the LIMIT 1) SELECT * FROM tablename WHERE tablename.id=123 LIMIT 1 or only update 1 row UPDATE tablename SET somefield='somevalue' WHERE tablename.id=123 LIMIT 1 Would adding t...

Help me write a SQL Crosstab query

I have 3 tables that look like this: tblVideo: VideoID | Video Name 1 video 1 2 video 2 3 video 3 4 video 4 tblCategory: CategoryID | CategoryName 1 category1 2 category2 3 ...

Excel VBA Maniplating a CSV with SQL

This line of VBA code downloads a CSV file from the web and dumps the data into a spreadsheet. Can someone please help me figure out how to tweak the SQL in this code in order to select the "Close" column in the CSV table and insert that column into the spreadsheet? Thank you! Sub test() Dim sqldata As QueryTable Set sqldata = Active...

SQL : ERROR: more than one row returned by a subquery used as an expression.

The thing is that it does return one row. Here's the thing. SELECT... FROM... WHERE... GROUP BY... HAVING randomNumber > (SELECT value FROM.....) Whenever I have signs such as =, > it always returns me this error. When I do IN it doesn't. Are you not supposed to use comparison signs when comparing to another table? ...

count number of tuples without COUNT. Is it possible?

Hi, I would like to know if there is any way of counting the number of tuples in a table without actually using the COUNT function? A B C XXXX YYYY IIII XXXX SSSS PPPP RRRR TTTT FFFF KKKK AAAA BBBB If I would like to know how many times XXXX has appeared with...