|
thanks for reply
i have done this by
select headname,frequency,sum(c1) from feeshead where months in('jan','feb','march')group by headname,frequency
|
|
|
|
|
Select SUM(fees) FROM TABLENAME
WHERE headname = 'jan' OR 'feb' OR 'march'
NOTE: The (fees) in the query
is the name of the column and
the "TABLENAME" should be replaced
with the table you want to perform
de query on.
NOTE ALSO: that SQL SERver is not case
sensitive
Jondo
|
|
|
|
|
hi
I have a Query, and I need to find the row number that the query return the answer
I do not have any counter field
how I do it ?
(i work with sql server 2005)
thank's in advance
|
|
|
|
|
Does COUNT function helps you?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
Do you really need the row number or do you really mean the primary key ? Typically, you don't reference relational data by a "row number", each table should have a primary key defined which uniquely identifies the row.
Maybe I just don't understand the problem.
|
|
|
|
|
hello all
,i am using the function Dataset.Merge(table, false, MissingSchemaAction.Ignore), to merge larg amount of table ..about 40 tables,the problem appear when some tables have large number of recordes...hence the performance become sooooooo bad,it take about 6...7 m to complete merging for that table to that data set...so does anyone know how to enhance the performance for it ??
|
|
|
|
|
Hi if anyone could help I would appreciate it. I have a database with a
Movies Table, Casting Table, and Actor Table.
Movie Table has MovieID
Casting Table has MovieID , and ActorID
Actor Table has ActorID
This code deletes a row from the movies table(using a datagrid in vb.net), I need all the rows in the Casting table with the same MovieID to also be deleted.
Any help would be appreciated!!
Dim result As String
Dim i As Integer
i = MovieDataGridView.CurrentRow.Index
result = MsgBox("Are you sure you want to delete this movie?", MsgBoxStyle.OkCancel)
If result = vbOK Then
If MovieDataGridView.Rows.Count = 1 Then
MsgBox("You must leave one movie in database!!")
Else
Me.MovieDataGridView.Rows.Remove(Me.MovieDataGridV iew.SelectedRows(0))
End If
Else
End If
Me.Validate()
Me.MovieBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.MovieProjectDa taSet)
|
|
|
|
|
I got it to work like this, I added a new query called GetDatabyDcast to my casting datatable that says
DELETE FROM Casting WHERE MovieID =@MovieID
then I added that into the delete button. This probably isnt the best way to do it but it got the job done. If you know a better way, then let me know please. Thanks
Dim result As String
Dim i As Integer
i = MovieDataGridView.CurrentRow.Index
result = MsgBox("Are you sure you want to delete this movie?", MsgBoxStyle.OkCancel)
If result = vbOK Then
If MovieDataGridView.Rows.Count = 1 Then
MsgBox("You must leave one movie in database!!")
Else
Dim s As Integer
s = Me.MovieDataGridView.CurrentRow.Index
Dim a As String = Me.MovieDataGridView.Item(0, s).Value.ToString
a = a
Dim ta As New MovieProjectDataSetTableAdapters.CastingTableAdapter
Dim tbl As MovieProjectDataSet.CastingDataTable
tbl = ta.GetDataByDcast(a)
Form3.CastingTableAdapter.Fill(Me.MovieProjectDataSet.Casting)
Form3.Validate()
Form3.CastingDataGridView.EndEdit()
Form3.TableAdapterManager.UpdateAll(Me.MovieProjectDataSet)
Me.MovieDataGridView.Rows.Remove(Me.MovieDataGridView.SelectedRows(0))
End If
|
|
|
|
|
JustinRiggs wrote: If MovieDataGridView.Rows.Count = 1 Then
MsgBox("You must leave one movie in database!!")
Why would you force the user to have one record at least???
Alexei Rodriguez
|
|
|
|
|
You can use a stored procedure that takes the MNovieID as a parameter and then something like this:
DELETE FROM Movies WHERE MovieID = @MovieID
DLEETE FROM Casting WHERE MovieID = @MovieID
You can put this code inside a transaction
But the easiest way is to set a foreign key in the Casting table with DELETE CASCADE, and when a movie is deleted, it will delete all the records in casting corresponding to the movie deleted
Alexei Rodriguez
|
|
|
|
|
hi guys
can anybody plz tell me what is difference between sqlexpr_adv.exe and sqlexpr_toolkit.exe?
thanks .
Tauseef A Khan
MCP Dotnet framework 2.0.
|
|
|
|
|
|
I am working on a customized Excel VBA function. I have developed a two dimensional array consisting of two fields. The first element is a Date field and the second field is an Integer field. The problem is that now I need to search through the array using the first field, and when a match is found to return the second field as the result. The name of the array is arrArray. It is a static array with a set number of records. How should I go about searching the array?
As an example, let us assume that there are ten elements and that they are properly loaded like this:
Dim arrArray(10, 1)
arrArray(#1/1/2006#, 1)
arrArray(#1/2/2006#, 4)
How do I search through the first element field for a match, and when a match is found to return the second element?
|
|
|
|
|
Assuming you have filled the array with something like:
arrArray(1, 0) = "#1/1/2006#"
arrArray(1, 1) = 1
arrArray(2, 0) = "#1/2/2006#"
arrArray(2, 1) = 4
Then something like this should do it
Dim retVal
Dim match
Dim i
match = "#1/2/2006#"
For i = 1 To 10
If arrArray(i, 0) = match Then
retVal = arrArray(i, 1)
End If
Next i
Regards
David R
---------------------------------------------------------------
"Every program eventually becomes rococo, and then rubble." - Alan Perlis
|
|
|
|
|
Hello All,
Problem:
I've a table which has dynamic columns, I dnot know how many they are becasue they are created dynamically.
Now I've to insert some of columns to other table.
But I'm unable to find the way to fetch the columns by index.
I want to use like this,
<br />
insert into tbl(TableName.Columns[0].Name,TableName.Columns[2].Name,.....,TableName.Columns[n].Name)<br />
values (TableName.Columns[0].Value,TableName.Columns[1].Value,.....,TableName.Columns[n].Value)<br />
Plz Help
Thanks
Syed Shahid Hussain
|
|
|
|
|
The following query returning the following result:
SELECT count(*) FROM `table1`;
--------------------
Resilt 2000
But the following Query returning different result
SELECT
table_name,
table_rows AS rows
FROM information_schema.tables
WHERE table_schema = 'bakrol14' and table_name = `table1`
Order by table_name;
--------------------
Result 2143
What is the reason?
|
|
|
|
|
|
hi all..
here is my problem:
DECLARE @RETURN1 FLOAT
SET @RETURN1 = 1234.12345
select ROUND(@RETURN1,4)
--*returns : 1234,1235
DECLARE @RETURN2 FLOAT
SET @RETURN2 = 12345.12345
select ROUND(@RETURN2,4)
--*returns : 12345,1234
DECLARE @RETURN3 FLOAT
SET @RETURN3 = 1234567.12345
select ROUND(@RETURN3,4)
--*returns : 1234567,1235
as you see above; when the length of digits leftside of the point is 4 it rounds up to #,1235.. but when length of digits is 5 it rounds down to #,1234 and when length is 7 it again rounds up to #,1235
whats wrong with that?
anybody has an explanation_?
|
|
|
|
|
Take a look at this document.[^]
Which result you want to get after you execute those querys?
From 1234.12345 you want to get 1234.1234 ?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
It is a float type conversion problem. Try using a wider data type. (use decimal with appropriate parameters)
|
|
|
|
|
|
if application use sqlapi to connect(remotely) to mysql/sql server at startup, then while application is running if mysql/sql service is restarted then connection will lost(execute() function of sqlapi says connection is lost).
But isconnected() and isalive() functions of SAConnection class in
sqlapi tells connection is not
lost. then how to know if connection is lost by which function?
|
|
|
|
|
Hi All
I am working on a vb 6.0 + MySQL project.
I need to create a Database(for local use Ex:- If user wants to create database they can create and dump data from online databas) Dynamically and restore the database with production database backup.
Is it possible?
Thanks,
Willington D
|
|
|
|
|
You are also cross posting.
Bad enough you want to use a dead platform to build on, now you want to cross post as well. Will you please move into the 21 century and use VB.net - it's FREE and you'll get much more support from the forums.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Yes it is possible. Use the ODBC driver for VB6 via a DSN and issue commands through ADO. Look-up the syntax on the MySQL website for CREATE DATABASE databaseName and associated admin functions.
|
|
|
|