|
Without knowing anything more on the issue, I'd say you should try to avoid delete/insert combination if the logical request is to update record(s). For example even it may be possible now, what happens if you add child tables underneath this table. Would the data in those tables be deleted/inserted also. Also I think there would be some locking related issues etc.
In most situations I've encountered this technique, it's been a modeling/architectural issue either in db or in the program or in both.
But as said, with the info you provided, it's hard to say more.
|
|
|
|
|
Consider the following:
ClothingStyle Size
============= ====
ID ID
Description Description
For example, TShirts can come in S, M, L, XL, XXL where each of these is in the Description column of Size. So the relationship here is 1:M. However, sometimes some clothes have a two dimensional size. For example, jeans can come in waist sizes of 26, 28, 30, 32, 34 and so on but can also have length. How can I create the structure for such a scenario?
|
|
|
|
|
You can use something like this i think, I use something similar for Product Properties.
ClothingType(
ID
Name
)
ClothingProperty(
ID
ClothingTypeID
PropName
UOM
Description
)
ClothingPropertyValue(
ID
ClothingPropertyID
ClothingID
Value
)
I don't speak Illidiot - please talk slowly and clearly
|
|
|
|
|
No, no, you got it all wrong use Attribute instead of Property, why b/c I like Attribute, I have no idea why, prejudiced I guess.
Oh the structure is the same of course
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Table Name: MyTable
ID NAME DATE
=============================
1 James 2008-08-29
2 Jack 2008-08-29
3 James 2008-08-31
4 Jack 2008-08-31
=============================
Above is my table named MyTable with fields ID, NAME and DATE. I got 2 different Names with two different Dates.
There are two records for James with different Dates:
James 2008-08-29
James 2008-08-31
..and two records for Jack with different Dates as well:
Jack 2008-08-29
Jack 2008-08-31
What I want is to display the record like this:
NAME DATE1 DATE2
=================================
James 2008-08-29 2008-08-31
Jack 2008-08-29 2008-08-31
=================================
I want to combine the records with the same Name and place the different Dates in separate columns. Please help me figure out what is the right SQL Query for this. Thanks in advance!
|
|
|
|
|
I presume you are using sql server 2005 or later. What you need is a pivot table.
This article may help[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
How do I get rid of the following erroe message?
The syntax 'for replication startup options' is deprecated and will be removed in MySQL 5.2. Please use 'CHANGE MASTER' instead.
|
|
|
|
|
|
It is already in my my.ini File on all my Slaves.
It is as follows:
CHANGE MASTER TO
MASTER_HOST='master-hostname'
MASTER_USER='slave-user'
MASTER_PASSWORD='slave-password'
What else do you suggest trying?
|
|
|
|
|
Instead of adding it to my.ini, I think you should execute the CHANGE MASTER command. That command modifies the master.info file and sets the new values for each option you specify. Those options that you do not specify are left unchanged.
|
|
|
|
|
Do you run that command on the MASTER Server or all of the SLAVE Servers. I am running Windows XP Professional on all Units.
|
|
|
|
|
On the slaves. From documentation:
"CHANGE MASTER TO changes the parameters that the slave server uses for connecting to and communicating with the master server"
|
|
|
|
|
I ran the same command set on each of the slaves, stopped each of the slave servers after updating the information and then restarted them each. Went back to the Main server and stopped it and restarted it. Got the same exact error message upon starting the server.
Trying to start the server ...
Server was started.
The syntax 'for replication startup options' is deprecated and will be removed in MySQL 5.2. Please use 'CHANGE MASTER' instead.
Slave SQL thread initialized, starting replication in log 'MEDCO1.000002' at position 4, relay log '.\MEDCO1-relay-bin.000036' position: 4
Event Scheduler: Loaded 0 events
C:\Program Files\MySQL\MySQL Server 5.1\bin\mysqld-debug: ready for connections.
Version: '5.1.30-community-debug-log' socket: '' port: 3306 MySQL Community Server - Debug (GPL)
Slave I/O: error connecting to master 'slave-user@master-hostname:3306' - retry-time: 60 retries: 86400, Error_code: 2005
|
|
|
|
|
Do you still have the options in my.ini. That would explain the problem. Also you should check that there are no leftovers in master.info. That overrides my.ini.
|
|
|
|
|
All lines of code that pertain to the Previous Change Master are removed from the My.ini files. Is there anyway to change or verify the master .info file or Purge it?
|
|
|
|
|
I don't know if they have a tool for that. You could search on their site or manuals. However, if I remember correctly, master.info is plain text so you can easily check it's contents.
|
|
|
|
|
I have Seven Separate MySQL Servers that Have The Same Local Databases on Each Platform that need to update each other at the completion of a run (or test). Each Server will Retain its local results and also update the other 6 Servers when it completes its test or run. It can run in stand alone mode if Network is Down. If Network is up it must receive the other 6 Servers Informatio as well when the other servers complete a test or run and the Network is up. What is the easiest Way to accomplish this using the free features of MySQL? Please provide examples or free utilities or code generators that can accomplish this. Regards. BC.
|
|
|
|
|
Sounds to me like a homework question. How do YOU expect to achieve this?
BobClarkSQL wrote: Please provide examples or free utilities or code generators that can accomplish this
Try google.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
I was wondering if someone knows how to use a DBI to exec a sql script and copy the data collect to an Excel Spreadsheet?
|
|
|
|
|
What Database you ues?
If you use sql server,You can do it with a simple export with Intergration Service of SQLServer.
|
|
|
|
|
|
Urgent help Please!
I have a table exist in two database on two different server in sql server. I want to get the data of table from one table and another. When I am using OPENROWSET command it through error. I don't know what it mean. Is there any way to migrate the data. One problem is that I have a column for multi language when i migrate the date the multilingual colum show ??????? and not the original one.
thanks in advance
|
|
|
|
|
It would greatly help if you post the command you tried to use and the error message you got.
|
|
|
|
|
Hello!
I m planning to use PostgreSQL but I have one doubt how can i take a backup.
I check some of website they refer dump command that also for LINUX How can i take backup in XP and how to restore after partition plz help me.
and i want to know where that backup file is stored.
Thanx's in advance.
|
|
|
|
|
PostgreSQL uses a little bit different approach than most of DBMS's do. It creates a file containing SQL commands which can be again executed back to an empty database. This will lead to the situation where the database was when the dump was made.
Dump is taken using pg_dump or pg_dumpall utility and the result will be echoed which then again can be redirected to a file and to a place you choose.
For more info, look: SQL Dump[^]
Addition:
Of course every database can be backed up by taking copies from the files using operating system, but in order to do that, the database engine must be first shut down in order to get a consistent image.
modified on Tuesday, January 20, 2009 12:56 PM
|
|
|
|