|
Look into using an INSERT/SELECT statement.
|
|
|
|
|
One thing that you can do is combine an insert and a select command together, so you actually get the values inserted that you select from the select query. Your command becomes something like this:
INSERT INTO tbl_ply_hankypark(song_id)
SELECT hankypark.ID FROM hankypark
LEFT JOIN tbl_ply_hankypark ON
hankypark.ID = tbl_ply_hankypark.Song_ID
WHERE (((tbl_ply_hankypark.Song_ID) Is Null))
|
|
|
|
|
Thnak you for both replies I knew I would get the right directions here
Many Thanks for you help
Regards
Ray
|
|
|
|
|
|
Thanks in Advance
Can some one suggest me , any Good eBook for Oracle 11g
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
modified on Wednesday, October 6, 2010 6:32 AM
|
|
|
|
|
Oracle 11g is a massive beast. You need to clarify what you are looking for here - programming? DBA?
|
|
|
|
|
Thanks for the reply " Programming "
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
There's an ebook for this[^] one. The printed copy is excellent (I never buy ebooks, I prefer paper copy).
|
|
|
|
|
Isn't that fairly new, I be astonished if there were many books published yet.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Actually there are some but i want any recommendation/Suggestion
SOFTDEV
Luck in life always exists in the form of an abstract class that cannot be instantiated directly and needs to be inherited by hard work and dedication.
|
|
|
|
|
Hi.
I have a problem with an xml.
I don't know how to read a piece o an xml.
This is the xml:
<root IDUtilizator="1" IDFormular="210">
<Forma R1="2" NumeCamp0="Numar" R2="20101006" NumeCamp1="Data" R3="2040" NumeCamp2="NrRegistratura" R4="20101006" NumeCamp3="DataRegistratura" R5="20100301" NumeCamp4="De la" R6="20101006" NumeCamp5="Pana la" R7="0" NumeCamp6="Data de referinta" R8="0" NumeCamp7="Tip persoana" R9="1000125" NumeCamp8="Tip taxa" R10="0" NumeCamp9="Utilizator" R11="0" NumeCamp10="Insolventi" R12="0" NumeCamp11="Sortare dupa" DataMod="20101006" />;
<Selectat Col1="PF-Da-Taxa apa apometru" />
<Parametrii Sir="Optiuni selectie: Numar=2 Data=20101006 NrRegistratura=2040 DataRegistratura=20101006 De la=20100301 Pana la=20101006 Data de referinta=Data document Tip persoana=PF/PJ Tip taxa=Cu debit Insolventi=Nu Sortare dupa=conturi bugetare " />
I don't know how to get the information from the Parametrii Sir.
Maybe you have an idea.
thanks
|
|
|
|
|
Can you please advicing a very Good artical on Query optimization techniques SQL server database. currently my DB performance is very very slow. Pleaes advice.
Thanks in advance
|
|
|
|
|
|
|
|
|
you're welcome.
|
|
|
|
|
Here's what I'm trying to do, using C#:
1 - Connect to SQL Server
2 - Check if a database is present.
3 - Create the database if it isn't.
4 - Create a login/user pair for that database.
5 - Store the connection string for future use.
I have this done, confirmed by using SQL Server Management Studio Express.
The following method throws an SqlException:
private static SqlDataReader executeQuery(String query) {
SqlCommand command = new SqlCommand(query, Connection);
SqlDataReader reader;
try {
openConnection();
reader = command.ExecuteReader();
return reader;
} catch {
throw;
} finally {
}
}
The query: SELECT ReportGroupName FROM dbo.ReportGroups
The error message: Invalid object name 'dbo.ReportGroups'.
The offending line of code: reader = command.ExecuteReader();
Some lines from the script I used to create the database, tables and user:
CREATE LOGIN [bim] WITH PASSWORD=N'*******', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
EXEC sys.sp_addsrvrolemember @loginame = N'bim', @rolename = N'dbcreator'
CREATE USER [bim] FOR LOGIN [bim] WITH DEFAULT_SCHEMA=[dbo]
CREATE TABLE [dbo].[ReportGroups]
I have a feeling that the problem lies with how I setup the default user, since I'm still learning databases, and it's been pretty hit or miss. However, the application worked previously using the above method with the same query string - the exception has only occurred recently, after creating the database from a script rather than in using the visual editors in SQL Server Management Studio. The script I used to create the database was derived from exports of the original database and tables, with only modifications made to create a login and a user.
Any assistance on tracking down how to fix this error would be greatly appreciated.
|
|
|
|
|
Hrm.
It appears that I wasn't setting InitialCatalog when building the connection string, at least not in the right place. You don't have to have an initial catalog when testing a connection to a database, which is code near what I'm doing, but you do have to have it to access database tables.
I was worried that it was something simple - turns out it was. Upon reflection, I'm kind of glad.
|
|
|
|
|
Hello everyone
I have a table named "volleyballpool8"
it has columns as ID, Pool, TeamNo, Team and Point
There are 11 rows in this table and there are 4 different "Pool"s, as A,B,C and D
Now
I need to make a SELECT statement to form a table, which:
1-Gets the ID, Team and Point of the row with the HIGHEST "Point" value of Pool='A's
2-adds the ID, Team and Point of the row with the SECOND HIGHEST "Point" value of Pool='B's
3-adds the ID, Team and Point of the row with the HIGHEST "Point" value of Pool='C's
4-adds the ID, Team and Point of the row with the SECOND HIGHEST "Point" value of Pool='D's
Therefore, in the end, I'll have a 4 rowed table
I'm somewhat new to SQL and I got confused...
Can anybody help?
btw: all of the fields are strings
|
|
|
|
|
I would appreciate any answer that makes the full query above but with some brute coding, I can handle myself in .cs part of the project if you only tell me how to get a "SECOND HIGHEST" from a table
for the highest of A's, I'm using
SELECT ID as row, Team, Point FROM cadet_games.volleyballpool8 WHERE Pool = 'A' and Point=(select max(point) from cadet_games.volleyballpool8)
If I don't get answer soon enough, I'll have to use multiple dataTables to concat later. But still I need some "second highest" query
|
|
|
|
|
Hi,
question: what is the second highest in this collection: 4, 4, 2, 1? is it 4 or 2?
Anyway, you should look here[^].
|
|
|
|
|
well, there are lots of fields in this table and some of them are "for, against"...etc I'm adding those to my query as well, now, just think that Point column is unique
btw, thanks for the answer, I'll have a look at it
|
|
|
|
|
Hey!
be sure that I've done that before I ask to you guys =)
I'm googling and querying at the same time
|
|
|
|
|
Couldn't find a single query to do all above, but decided to do it C# style
thanks all anyway
|
|
|
|