We're developing a "Search Reporting" feature for a client. One of the requirements is that they can view a particular result and see which search terms lead to it.
Our search_results table is simply a mapping of searches.id to results.id.
So we need to do a bulk insert into this table and need to know the fastest way to do this withou...
Good Morning,
i have some Trouble with the Zend Framework and Zend_DB_Select, i want to use
this (Working) SQL Statement as Zend DB Select Statement :
select
oslang
from
oslang, os
where
oslang.oslang_id = os.oslang_id and
ossubversion_id = 1
I have tryed to following but it doenst work :
try {
$select = $this->_db->...
I want to fetch the unmatching records from two table in SQL, the table structure is as follows:
Table1
Id Name
1 Prashant
2 Ravi
3 Gaurav
5 Naween
7 Sachin
Table2
Id Name
1 Prashant
2 Ravi
4 Alok
6 Raja
The output I want is
Id Name
3 Gaurav
4 Alok
5...
I have a system where a user uploads documents (pdf, word) etc. The problem being, foreign users are uploading filenames in arabic, chinese, japanese and the system, being able to handle them, is adding them to the database.
Where the problem arises is trying to download the files using php:
$result = mysql_query($query) or
die(...
I want to write an SQL query using the LIKE keyword. It should search the first character or the starting character of my column with the search parameter.
Is there a specific syntax for doing this?
...
I got two tables Product(Productname VARCHAR(10), Rating REAL) and Review(RatingID INT, Productname VARCHAR(10), Rating INT).
The Rating of the product is the average of all Ratings given in reviews for that specifig product.
I'd like to have a trigger, that updates a product whenever a new review is inserted or update, but I just can't ...
I'm currently trying to optimize a MYSQL statement that is taking quite some time. The table this is running on is 600k+ and the query is taking over 10 seconds.
SELECT DATE_FORMAT( timestamp, '%Y-%m-%d' ) AS date, COUNT( DISTINCT (
email
) ) AS count
FROM log
WHERE timestamp > '2009-02-23'
AND timestamp < '2020-01-01'
AND TYPE = 'play...
I want to use the like keyword in a dynamic parameterized query. I want to protect my query from SQL injections so I don't want to pass the value, instead I want to pass my criteria while executing the query,
Is there a way I can do this?
SELECT
ComposeMail.ID,
ComposeMail.DateTime,
ComposeMail.Subject,
ComposeMail.CreatedB...
Hi,
I got a query with five joins on some rather large tables (largest table is 10 mil. records), and I want to know if rows exists. So far I've done this to check if rows exists:
SELECT TOP 1 tbl.Id
FROM table tbl
INNER JOIN ... ON ... = ... (x5)
WHERE tbl.xxx = ...
Using this query, in a stored procedure takes 22 seconds and I woul...
I need to exclude a product line from a database so I do pline != prodctline but certain products in that product line I do not want to be excluded.
For instance:
here is simlplistic version of my database:
partname, pline, option (3 columns)
i want to exclude all results from a certain product line unless they have X option value.
s...
i am storing files in database and this is the code i am using and it works in adding the data, but now i want to retrieve it back. how can i do that?
string filename = FileUploader.PostedFile.FileName;
string filecontent = FileUploader.PostedFile.ContentType;
int filesize = FileUploader.PostedFile.ContentLength;
string fil...
a report in my application runs a query that needs between 5 - 15 seconds (constrained to count of rows that will be returned).
The query has 8 joins to nearly all main-tables of my application (Customers, sales, units etc).
A little tool shows me, that in this time, all those 8 tables are locked with a shared table lock. That means, no...
I have a PDF file on a local machine. I want to upload this file into a BINARY BLOB on a SQL database. Other approaches mentioned here [http://stackoverflow.com/questions/17/binary-data-in-mysql] all use PHP. I want a simple clean way to upload this PDF file on the Linux command line. Unfortunately, I do not have access to the remote fil...
Hi,
I'm trying to create a query on SQL server 2005 that will check if the sum of some fields in some detail records is equal to the total field in a header record. This will be used for creating electronic deposit of checks for the company I'm working for.
The hierarchy looks like this:
Deposits --> Batches --> Checks
Before creatin...
I would like to be able to use a Dataset as an in-memory datastore.
I want to be able to use SELECT, INSERT, UPDATE, and DELETE, CREATE TABLE, DROP TABLE, ALTER TABLE ADD COLUMN, ALTER TABLE DROP COLUMN, and support for Constraints PRIMARY KEY, UNIQUE, NOT NULL, FOREIGN KEY, REFERENCES.
...
How do I use DB2's Explain function? -- both to run it, and to use it to optimize queries. Is there a better tool available for DB2?
I've built queries before, but the only way I've had to tell how long they'd take is to run them and time them -- which is hardly ideal.
Edit:
The answer for me turned out to be "You can't. You don't ha...
I'm fairly new to SQL, & I need help with an Insert statement.
I have two tables -- Current & Old. The Current table has columns that are new & therefore isn't in Old. One of my users deleted a record from Current, & I'd like to add the record to Current from Old.
I tried a simple Insert statement that "pulls" the data from Old into Cu...
Sorry for the unhelpful title, but hopefully I can explain this well enough.
Lets say I have three tables,
Item
ItemKey
ItemName
Group
GroupKey
GroupItem
GroupKey
ItemKey
Given an ItemKey, how would I get all records from the item table that belong to a group containing the item key?
So if I have
Item
1 ItemA
2...
Hello everyone
We have a table that is used for assessment-values in our tool where each value has its valueid. Dont ask me who came up with this so called design, but now I need to add multiple valueids to the end for each assessment.
So, it looks like this:
AssessmentId 1, ValueId 1, Value
AssessmentId 1, ValueId 2, Value
Assessment...
I want to union the result of two sub-queries (say SUB1 and SUB2). The sub-queries have multiple columns including an ID column.
If an ID=1 exists in SUB1, I want the union result to include only the row of ID=1 from SUB1 and not include the ID=1 row from SUB2.
eg. if SUB1 had the following columns and rows
ID | Date
1 | 7/1
2 | 7/3...