sql

MySQL multi table join query

Result needed: The registration number of the cars used by Instructors at the Glasgow, Bearsden office. The 3 relevant tables I have are; ( I have omitted the non-relevant table information, to simplify this. The database is called easydrive. No this is not a School or UNI assignment, it is a question from a text book, that we have bee...

Reporting Services 2008: "HTTP status 401: Unauthorized" Issue

I'm getting the error "The request failed with HTTP status 401: Unauthorized" whenever I try to list the reports on my reporting server. The weird thing is, it works when I run the asp.net application on my dev machine hitting the server reporting services web service url (http://www.example.com/reports/reportservice2005.asmx?wsdl) but w...

HTML5 readTransaction not supported on iPad (iOS 3.2)?

I have a HTML5 app that uses websql for storing data. Where possible, I'm using the readTransaction() method for read-only SELECT queries, and the transaction() method for INSERT/UPDATE/DELETE queries. I'm not sure if there's a performance benefit to using readTransaction(), but it seems like the right thing to do. The app works fine ...

How to select the five greatest number mysql

Hi, How to select the first five high number from my table for example: bid_table > 10 customers enter bid, and the query need to give only the five high bid from this 10 customers thanks Yaniv ...

Int Result Doesnt Increment using Cmd.ExecuteScalar PRoblem?

Now this is my Code on Updating Records. Data Access: public int UpdateBatch(FillinEntity fin) { int result = 0; using (SqlConnection conn = new SqlConnection(connStr)) { conn.Open(); using (SqlCommand dCmd = new SqlCommand("UpdatebyBatch", conn)) { dC...

Why is the comma messing up the insert

here is my query insert into invoices set Invoice_number = '823N9823', price = '11,768.00', code = 'ret_4_business', created_at = '2010-09-27'; but my price in my db is 11, not 11768 how do i handle money in mysql? the field is a decimal CREATE TABLE `invoices` ( `id` int(11) NOT NULL AUTO_INCREMENT, `Invoice_n...

How to invertly select columns in sql?

If I have a SQL table with columns: NR_A, NR_B, NR_C, NR_D, R_A, R_B, R_C and on runtime, I add columns following the column's sequence such that the next column above would be R_D followed by R_E. My problem is I need to reset the values of columns that starts with R_ (labeled that way to indicate that it is resettable) back to 0 ea...

Convert tabular data to XML using SQL Server

I have a flattened table that contains columns that represent groups that need to be displayed in XML. Example data: Market, Label, Style, Type XXX, YYY, JJJ, 111 XXX, YYY, JJJ, 222 XXX, YYY, JJJ, 333 XXX, YYY, JJJ, 444 XXX, YYY, LLL, 111 XXX, YYY, LLL, 222 XXX, YYY, LLL, 333 ...

Select most recent rows that match a condition in SQLite

Let's say I have a table: Name, status, timestamp And I want to select the rows that match status='active' but only those that have the most recent timestamp for each of them. So if there were rows like this: Bob, active, 5/10/2010 Bob, active, 6/12/2010 Ann, inactive, 6/12/2000 Ann, active, 9/3/2009 Ann, active, 9/25/2010 I'd wan...

iterate thru SQL db by row

Hi, Not sure if phrasing this right, seems simple but not sure best way to do it. Basically, I've got a simple database identifying items of clothing. Just ItemID(PK), ItemName and ItemLink(just the name of the jpeg for that item, which I'll use in .net to construct the correct image url for that item). Client doesnt want anything fan...

Determining row changes since last access in SQL Server

We have a multiuser system with users saving to a central SQL Server 2005 database. We have encountered an issue where a user refreshes in changes from the db while another user saves new data. The way we are currently collecting the changes is we have a timestamp column on each table which is filled at every row insert/update. Another u...

getting Error in insert command in asp.net (string truncated)

i working on asp.net 2.0 and my database is sql server 2005 i am getting error STRING OR BINARY DATA WOULD BE TRUNCATED THE STATEMENT HAS BEEN TERMINATED ON line cmdRegister.ExecuteNonQuery(); THIS MY CODE protected void cmdRegisterme_Click(object sender, EventArgs e) { lblAmount .Text = HFamount .Value ; stri...

select top 3rd record from a column in sql

how to select top 3rd record from a column in sql ...

Primary Key and ER models

Say i have an ER model _____________ | E2 | |_____________| | | | | | | A21* A22 A23* where the A21 and A23 are primary keys. Would this mean the primary key for E2 will be PRIMARY KEY(A21, A23)? If so, then what is the difference of the diagram below. _____________ | E2 | |_____________| | ...

How do you get a sum() twice from one table with different where clause?

SELECT sum(qty) as accept, (SELECT sum(qty) FROM pile WHERE pf=false) as reject FROM pile WHERE pf=true; That's the SQL I use currently, but I'm guessing its not best practice? The other alternative I used before was SELECT sum(qty) FROM pile GROUP BY pf but I need them as columns and not as rows. Are there any...

Summarize the result of the table

I am using PostgreSQL. I have the data in table like: Parent_id Count Read --------- ------ ------ 52405 2 False 52405 1 True Now i want to summarize the data like : Parent_id Count Read --------- ------ ------ 52405 3 False Count would be the sum o...

How can make Column that allow null to be unique from SQL Server 2005 ?

I have column in a table that allow null but i want to make constraint that make him null or unique ... How can i do that ? Note : I validate it from the frontend but i want to have a physical in sql server that allow this even developer try to enter data ...

SQL - Select all rows added yesterday efficiently

Hi, I want to select all of the rows added to a table which were added "yesterday" i.e. the day before whenever I choose to run the query. At the moment my query looks like this: SELECT row_date (etc) WHERE row_date >= trunc(sysdate-1) and row_date < truc(sysdate); Is there a more efficient (and, hopefully, readable) way of ...

rank items in sql by dates

I have movies table with movieID,movieName and movieDate. I want to select first all movies which added in last 24 hours and order them by date and the rest order by newid(). ie. 1 babylon 28/09/2010 16:00 2.12 monekys 28/09/2010 8:00 3.se7en 25/09/2010 5:00 4.snatch 26/09/2010 18:00 How can i achieve it? Final answer which is a c...

DB2 truncated output

Hi, when i make select (command prompt WinXP) like: enter code here db2 select message_data from messages where message_id = 20043 i get output + 'Output is truncated' message. message_data is LONG VARCHAR > 30000 characters If i do like: enter code here db2 select message_data from messages where message_id = 20043 > c:\otpt.xml ...