I have a combo box that I want to pop up when somebody wants to search by year.
It will allow them to see in that combo box only results that happened in a certain year.
So far I have something like
SELECT DISTINCT Database_New.ASEC
FROM Database_New
WHERE (((Database_New.Date) >= DateValue('01/01/2001')
AND (((Database_New.Date) <= ...
how do i write a query that returns aggregate sales data for California in the past x months.
----------------------- -----------------------
| order | | customer |
|-----------------------| |-----------------------|
| orderId int | | customerId int |
| customerId ...
Ok let me try this again.
query("CALL getemployee('$eml')");
$result = $sql->fetch_array();
?>
This is my stored procedure:
Delimiter //
Create procedure getemployee(in eml varchar(50))
Begin
Select * from employees where email = eml;
End//
Delimiter ;
The error i get from browser:
"Fatal error: Call to a member function fetch_ar...
I noticed This question, but my question is a bit more specific.
Is there any advantage to using
using (SqlConnection conn = new SqlConnection(conStr))
{
using (SqlCommand command = new SqlCommand())
{
// dostuff
}
}
instead of
using (SqlConnection conn = new SqlConnection(conStr))
{
SqlCommand command =...
Hi i want to display join result of two tables but don't want to show matching column separately. I want it one instead of two. So please tell me what query should i use for this. I am using SQL Server 2008 and my query is like:
select *
from Customer_Order, optRelation
where Customer_Order.orderNumber = optRelation.orderNumber AND...
AJAX autocomplete is fairly simple to implement. However, I wonder how to handle smart tag suggestion like this on SO.
To clarify the difference between autocomplete and suggestion:
autocomplete: foo [foobar, foobaz]
suggestion: foo [barfoo, foobar, foobaz], or even better, with 'did you mean' feature: [barfoo, foobar, foobaz, fobar, ...
Let's say I have a dataset in an ASP.NET website (.NET 3.5) with 5 tables, each has roughly 30,000 rows and an average of 12 columns. I want to insert all of the data from the dataset into 5 very-similar-but-not-quite-identical tables in SQL Server 2008. I also want to use LINQ (personal preference - trying to learn something new).
Is...
I'm writing the following code to convert SQL to LINQ and then to XML:
SqlConnection thisConnection = new SqlConnection(@"Data Source=3BDALLAH-PC;Initial Catalog=XMLC;Integrated Security=True;Pooling=False;");
thisConnection.Open();
XElement eventsGive =
new XElement("data",
from c in ??????
select new XElement("ev...
i have to make a string by using the values which the user selects on the webpage
suppose i need to display files for multiple machines with differnt search criteria..
i currently use this code:
DataTable dt = new DataTable();
SqlConnection connection = new SqlConnection();
connection.ConnectionString = ConfigurationMa...
This is a really silly question probably, I'm working on a database and what I want to do is create a table with an ID (auto increment) and another column: "Number" (I realize it sounds useless but bare with me here please), and I need to fill this "Number" column with values from 1 to 180, each time adding 1 to the previous.
What would...
how do I do a 'select for update' and then 'update' the row using ruby oci8.
I have two fields counter1 and counter2 in a table which has only 1 record. I want to select the values from this table and then increment them by locking the row using select for update.
thanks.
...
I have test_scores table with following fields:
Table schema:
id (number)
score1 (number)
score2 (number)
score3 (number)
score4 (number)
Sample data:
id score1 score2 score3 score4
1 10 05 30 50
2 05 15 10 00
3 25 10 05 15
Expected result set:
id col_name col_value
1 score4 ...
I have a sql statement where I'm joining about 4 tables, each with 200K rows. The query runs, but keeps freezing. When I do a join on 3 tables instead, it returns the rows (takes about 10secs). Any suggestion why? suggestions to speed up?
Thanks!
Code
SELECT *
FROM equipment, tiremap, workreference, tirework
WHERE equipment.tiremap = ...
Hypothetical situation: I work for a custom sign-making company, and some of our clients have submitted more sign designs than they're currently using. I want to know what signs have never been used.
3 tables involved:
table A - signs for a company
sign_pk(unique) | company_pk | sign_description
1 --------------------1 ----------...
I have a custom SQL call that is returning different results to the template than I get when I run the same query against the database directly, 1 row vs 2
Query - copied from Django Debug Toolbar:
SELECT ((Sum(new_recruit_interviews) / Sum(opportunities_offered)) * 100) as avg_recruit, ((Sum(inspections) / Sum(presentations)) * 100) ...
I'm writing a website in ASP.NET MVC, using the ASP.NET MVC 1.0 template that was added to VS2008 for me by the ASP.NET MVC installer. The template automatically adds an AccountController, but its account methods tie into a SQL Server Express entity. I don't have Express installed here. How can I reconfigure it to use my SQL Server 2008 ...
Dear all,
Kindly look at the following code as this sample code gives an error when i hosted it on Hostexcellence , but locally it runs perfect, and the error is as the following:
Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in u...
Hi Team,
Could you please list some of the bad practices in SQL, that novice people do?
I have found the use of "WHILE loop" in scenarios which could be resolved using set operations.
Another example is inserting data only if it does not exist. This can be achieved using LEFT OUTER JOIN. Some people go for "IF"
Any other thoughts?
...
I have one table, which has three fields and data.
Name , Top , Total
cat , 1 , 10
dog , 2 , 7
cat , 3 , 20
horse , 4 , 4
cat , 5 , 10
dog , 6 , 9
I want to select the record which has highest value of Total for each Name, so my result should be like this:
Name , Top , Total
cat , 3 ...
Hi
In a different post I got a reply that tells about Repetitive SQL. Could you please explain what is Repetitive SQL?
http://stackoverflow.com/questions/2657459/sql-code-smells
I thought to make it a new post as it is a different subject.
The reply says that use of "multiple stored procedures that perform the exact same joins but dif...