|
use union
example:
SELECT * FROM Table1<br />
UNION<br />
SELECT * FROM Table2
I Love SQL
|
|
|
|
|
|
|
How does this solve the problem? Did you even read his post?
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Well, that will not solve my problem, because I do not know exactly how many months/years there could be in the first place.
I do have something like this:
select count(ID), type, year(creation_date), month(creation_date)
from table1
group by year(creation_date), month(creation_date), type
which returns the count per type/month/year... After that I just want to show top 5 types per month/year...
As I said, I could do something like what I want with a stored procedure, with a loop foreach month/year, but I do not know how to run a stored procedure from inside another stored procedure...
I've tried 'exec sp_getdata' from inside the other stored procedure, but that didn't work...
Joao
|
|
|
|
|
A non-clever method is to use temp table instead of a single sql script. :p
|
|
|
|
|
|
by using sql server agent we backup the database as we required.in the same way can i send an email.
what my requirement is , to send mails to relevent parties when the complaints are not handled within 24 hrs , they are lodged.
to send the email i should specify the mail server,but what if i'm not having a mail server and using a free mail server in the internet,how to configure the database mail..
-- modified at 0:15 Wednesday 12th September, 2007
|
|
|
|
|
if you are using 2005 then it has built in email.
If you are using SQL2000 install CDONTS and look for articles on google on how to use it,
|
|
|
|
|
I want to filter my data while im typing the word that i want to search on a textbox.tnx
Sunshine
|
|
|
|
|
Where is your data coming from ? It seems pretty straightforward to me, if you're using a database and want to filter from the DB. Just build a query on each keypress to return the data valid for that search.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
yes im using a database and the search result would appear to the gridview...im having a combobox that would give the textbox choices on which to filter...but i dont know how to use the like clause in the select statement propely..
sql = "Select Supplier_Information.Supplier_ID,Supplier_Information.Supplier_Name,Supplier_Information.Address,Supplier_Information.Contact_No, Products.Product_ID, Products.Product_Name,Products.Product_Type, Products.Present_Price, Products.Past_Price from Supplier_Information, Products where Supplier_Information.Supplier_ID like '%s-%' "
i have this code but it does not work properly...i want to come up with a textbox that would filter in every letter that they will type in the textbox.tnx
|
|
|
|
|
Whoah - this is a really bad design. Don't attempt to do this because you are going to be hitting the database after every keypress. The more users you have, the more you are going to hit the database. How would you handle the case where the user enters some text and then starts to delete text? Thats the same data being queried many times.
Please - rethink your design.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
any suggestive design that i could make?may i know exacly what is the bad design that you are pertaining of...tnx
|
|
|
|
|
I'm sorry, but I thought I'd made myself clear enough. Don't design a system where you are hitting the database so many times. Apart from anything else, you probably won't be able to retrieve the data and display it quickly enough if the user is a quick typist.
As for the design - identify a more natural point for retrieving the data.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
should i delete my combobox?or can i search any data on my database in my textbox without giving any choices for filtering
|
|
|
|
|
This has stopped being a question about databases and become a question about an autofiltering combo box. The exact details of how to do this depends on whether you are using Win Forms or ASP.NET.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
i using vb.net...actually i really want to know about filtering...hos to use the like clause for searching
|
|
|
|
|
shyne7 wrote: i using vb.net
VB.NET is a language. The question was about frameworks. Which framework are you using? The ASP.NET framework or the WinForms framework (both of which are part of the larger .NET Framework)
shyne7 wrote: hos to use the like clause for searching
WHERE SomeColumn LIKE '%'+@SomeSearchTerm+'%'
@SomeSearchTerm is passes as a parameter for security
|
|
|
|
|
u want to filter
so ,
u are writing the query. ok then in where clause
fieldname like '" & textbox1.text & "%'
u will get the result
|
|
|
|
|
tnx...that helps...but i have two tables in one gridview...how could i view those in my gridview when i search for a data that is only in one of the tables
|
|
|
|
|
rohitsrivastava wrote: fieldname like '" & textbox1.text & "%'
NO NO NO NO!!!! Do NOT inject into SQL strings like this. I've been banging on about this for THREE years now! Doesn't anyone know about SQL Injection Attacks?!
SQL Injection Attacks and Tips on How to Prevent Them[^]
|
|
|
|
|
Ah well - at least I did mention parameterized queries (albeit in another post) . Don't worry Colin - some of the more professional members of the site have read/taken in your message. Perhaps your technical test should include a query that's wide open for Sql Injection and then ask candidates if they can tell you what's wrong with it.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
We believe we know the interval when multiple records are being entered when they shouldn't be (we don't know why yet, vendor to figure that out). The interval is something like 00:00:45 or so. Using managerial fuzzy logic, I can get better than superbly screwed up data by grouping the records by timestamp. This really seems like it lends itself to a cursor operation to first indicate whether the sorted records are in the proper date range, then we go by time and place a value into a new field to help us sort based on some fine subtraction caluculation. All in a job to automate it.
Anyone have a better suggestion? I'm pretty good with cursors and once it's run once, I can ignore existing rows to reduce the operation. It just seems so clumsy.
Thanks in advance,
i
|
|
|
|
|
Are the multiple records dups? This post needs more info what do mean by interval?
|
|
|
|