Questions tagged "sql" (page No.1)

SQL Server create ordered #Temp table

I try to create ordered #Temp table: WITH Ordered AS ( SELECT ROW_NUMBER() OVER (ORDER BY [Quality] DESC) AS RowNumber, ImageID, Quality, Border, IsBest FROM [CatalogImages].[dbo].[Images] ORDER BY Quality) SELECT * INTO #Temp FROM Ordered ; SELECT * FROM #Temp ; but I get error: Msg 1033, Level 15, State ...

Most efficient way to sum data in C#

I am trying to create a friendly report summing enrollment for number of students by time of day. I initially started with loops for campusname, then time, then day and hibut it was extremely inefficient and slow. I decided to take another approach and select all the data I need ...

How to figure out if mysql index fits entirely in memory

Is there a way to determine whether a mysql index fits entirely in available memory? If so, how would I: Determine size of mysql indexes Determine available memory for the application Determine if the indexes fit entirely in memory ...

MySQL, Java, and TimeZone

I have a datetime type field some_field in a MySQL database. I can query the data using recordSet.getTimestamp("somefield"), which returns a java.sql.Timestamp object. However, the returned values stores a UTC time. Now if know the time zone is "America/Chicago", how can I convert the time. I ...

SQL Query: How to list joined values on the same row

I've got a table of job listings and a related table which contains the job listing ids and each of the field values in a 'field title' -> 'field value' format. So to get my listing of jobs, I've JOINED the tables in my SQL Query, but am getting ...

What version of JET does Windows Server 2003 ENT SP2 use?

Normally when you look software on Wikipedia you can find information regarding the version numbers of a product and what the differences are between versions. In the JET Wikipedia page I found the corresponding MS Access version and expected to find the corresponding JET engine version number...but it was ...

Distinct Records Count Totals Group by Month

I have a table of users where I need to run a report and show how many times the users were entered into the system for each month in a given year. I have created a table where the first column returns the distinct users. Next, to the right, ...

Retrieving original timestamp after replication using triggers

Scenario is this: We have two databases db1 and db2. Statements in db1 replicate to db2. Query 1 gets executed in db1. This is replicated to db2. Upon execution of replicated query 1 in db2, a trigger needs to run in db2. This trigger needs to update a table in db2, with timestamp of when ...

MySQL vs PHP query performance issues

I have a sql query that runs in like 2 seconds in mysql (Navicat) and it runs through 600,000 locations returning all the table data and calculates the distance between a lat and long that I put in. The SQL is something like this: select *, 3959 * acos( cos( radians(37) ) ...

effectively handling / troubleshooting large queries

i need to add another couple of left outer joins to my huge query. it's getting difficult for me because the query is too large for me to handle right now. i am wondering if there's some way to translate the query automatically in to venn diagrams. are there tools out ...

linq-to-sql joins with multiple from clauses syntax vs. traditional join syntax

What the difference between writing a join using 2 from clauses and a where like this: var SomeQuery = from a in MyDC.Table1 from b in MyDC.Table2 ...

sql query help in sorting a field that's got both string and numbers

I've got a text field called source_recid. It stores half string half number like strings in it. Example shop.orders.32442 the syntax is DATABASENAME.TABLENAME.RECID My goal is to scan this col and find out the biggest RECID ( the integer) in it. So, in a case like this shop.orders.32442 shop.orders.82000 shop.orders.34452 It would be the record whose ...

Joining a recordset and table in MS Access VBA

I'm trying to join a table with a recordset through VBA. Is this possible? I basically wanted to join two tables, but one of the tables needed to be filtered down even more before I joined them. ...

select case when not working as expected

I'm trying to understand how this works but can't figure it out yet. I have made this simple uery to test the case-when-then-end clause... SELECT case when quantity > 3 then count(*) end the_count_a, ...

Select random values from each group, SQL

I have a project through which I'm creating a game powered by a database. The database has data entered like this: (ID, Name) || (1, PhotoID),(1,PhotoID),(1,PhotoID),(2,PhotoID),(2,PhotoID) and so on. There are thousands of entries. This is my current SQL statement: $sql = "SELECT TOP 8 * FROM Image WHERE Hidden = '0' ORDER BY ...

How to make this SQL query using IN (with many numeric IDs) more efficient?

I've been waiting over an hour already for this query, so I know I'm probably doing something wrong. Is there efficient way to tailor this query: ? select RespondentID, MIN(SessionID) as 'SID' from BIG_Sessions (nolock) where RespondentID in ( 1418283, 1419863, 1421188, 1422101, 1431384, 1435526, 1437284, 1441394, /* etc etc THOUSANDS */ 1579244 ) and EntryDate between ...

Why ssrs 2005 report takes long time for execution when using parameter?

I am trying to execute one SSRS 2005 report. This report takes one parameter. If I don't use the parameter and write the value directly then it runs in 10 sec. eg. Select * from table1 where id = 122 If I use parameter then it takes long time like 10 to 15 ...

PostgreSQL crosstab/pivot problems

I have a prefs table, and here are the relevant columns: mydb=> SELECT pref_id, pref_name, pref_value FROM prefs; pref_id | pref_name | pref_value ---------+--------------+---------------- 1 | PagerNumber | 2125551234 2 | PagerCarrier | @att.com ...

« Previous12345678910 ... 45834584Next »Show All