me_I got the same records in row 1 and row 2. There are no distingushing ID's. How do I update only the 2nd one?
snoyesif there is no difference, then what does it matter which one changes? Just put a LIMIT 1 on there.
passageme_: there is no 'second one'. there is no guaranteed order to rows in the table that you don't impose with an order by
passage!t me_ about spreadsheet
ubiquity_botme_: Arjen's rule#1: A relational database is NOT a spreadsheet.
sisveubiquity_bot: not even Excel with multi-sheets? ;)
me_passage: thanks for explanation.
gwoztjoin #english
aungkhantminhello guys any one >
snoyes!t aungkhantmin ask
ubiquity_botaungkhantmin: You don't have to ask to ask, or state: "I have a question", Don't ask: "Is anyone around?" or "Can anyone help?". Just Ask The Question. Also, please read:
aungkhantminok bro
aungkhantmini am having porblem when reading our university text book, An Introduction to database system by C J Date,
aungkhantminsix edition
aungkhantminIn that Text book The query are not same With mysql tutorial on W3Schools
aungkhantminDid we still use the query from the text book ?
snoyesWhat are the two queries?
aungkhantmin(S JOIN SP ) WHERE P# = ‘P2’ ) [S#, CITY]
aungkhantminthat is the query in text book
aungkhantminIf we use this command in mysql console
aungkhantminwe got error
archivistreplace with names you want and are using
snoyesThere are many database systems, and while they generally follow the same principles, they implement the syntax a little bit differently in each.
snoyesThe text book seems like it's giving the general idea, but you'll have to learn the specific syntax for the particular implementation you want.
snoyesMySQL, SQL Server, PostgreSQL, Access, will all be a little different
aungkhantminSo , Is it just like a pusedo code ?
aungkhantminMay i know what is the DBMS for this type of syntax SQL Server ?
snoyesI doubt there is any database that implements exactly the syntax shown in the text book.
aungkhantminok Bro Tnx You
aungkhantminNow i can realize and continue reading
qakhanhi all, i am using following query to get a count of groups of values .
qakhanand i have an order group userfield ('C2D-EXTEN','C2D-PH') which count i need to take.
qakhanhow can i inclide userfield IN ('C2D-EXTEN','C2D-PH') and userfield IN ('D2C-EXTEN','Call-Out') in single query
snoyesSUM(userfield IN ('C2D-EXTEN','C2D-PH')) AS sum1, SUM(userfield IN ('D2C-EXTEN','Call-Out')) AS sum2 FROM... WHERE userfield IN ('C2D-EXTEN','C2D-PH', 'D2C-EXTEN','Call-Out')
aungkhantminguys i am confusing with this query CREAETE SNAPSHOT SC AS ( ( S JOIN SP) WHERE P# = ‘p2’ ) (S#, CITY) REFRESH EVERY DAY )
aungkhantminI am struggle in ( S# , CITY)
snoyesnone of that is MySQL syntax.
aungkhantminYes i am asking logic
aungkhantminI can figure out the out put table
qakhanThanks snoyes it working.
Xgcaungkhantmin: You might want to ask a clear question. A clear question will have clear detail. What you provided is not any language we've seen and means nothing.
Xgcaungkhantmin: First decide which channel to join based on the database you are using.
Xgcaungkhantmin: They all support significantly different forms of SQL.
gamelasterHello! I have table with three columns: id, userid and timestamp. I need to do that I don't insert same USERID and Timestamp. How to do that?
snoyesALTER TABLE tblname ADD UNIQUE(userid, timestamp);
gamelaster#1062 - Duplicate entry '100004XXX005986-2017-03-04 04:31:01' :-/
gamelasterHow to force that it will automatically delete all duplicates?
gamelasterALTER IGNORE TABLE presences ADD UNIQUE INDEX activity(userid, timestamp);
gamelasterthis doing same
sisvegamelaster: "INSERT ... ON DUPLICATE KEY IGNORE" *guessing*
gamelasterokay, thank you guys!
salle_gamelaster: Adding proper unique constraint is the right way to do it
gamelastersalle_ yep, already I done that by creating new table, adding an UNIQUE constraint, and then copy all data with IGNORE from old to new table. Thank you guys!
salle_gamelaster: Not that your ALTER IGNORE will work only if old_alter_table is set
salle_gamelaster: It is always good idea to create new table and insert rows there if you can afford it ;)
gamelastersalle_ : yeah!
ekhHello. For some reason, I have 3 tables (in 3 diff databases) I want to merge, and then remove duplicate records (excluding pk). PK is int. What is the most feasible method? (even if it involves a programming language)
snoyesdiff databases on the same server, or in different serves?
ekhdiff in same LAN.
snoyesmove them all to one server (mysqldump and import, or use TTS), and then do some INSERT...SELECT to put them together.
ekhthis is the easy part, what about the hard one? :P
snoyes!t us delete dupes
ubiquity_bot#mysql: If you have a unique ID and the name may contain duplicates then DELETE t1 FROM table1 AS t1 JOIN table1 AS t2 ON> AND; If you have other fields that need to be taken into consideration extend the join as needed. If it fails on a myisam table see
ekhextend more join, or extend the "ON" clause?
Xgcekh: Depends on how those fields matter. Normally, adjust the join condition.
mrpacketheadI have two tables.. table A and Table B. I want one of the feilds in Table A to only be allowed to use values that are in one colum in table A. How do i do that
thumbsmrpackethead: fields using values? what?
thumbsmrpackethead: or are you just trying to define a FK to the other table?
thumbsmrpackethead: if you want a check contraint, you'll have to use triggers since MySQL doesn't implement those.
mrpacketheadthums.. whats a FK?
thumbsmrpackethead: foreign key.
mrpackethead ahh
mrpacketheadi did set up FK's
thumbsmrpackethead: so what's the problem?
mrpacketheadthumbs.. problem is the constraints
mrpacketheadi did'nt know how to do that
thumbsmrpackethead: for check constraints, use a trigger.
mrpacketheadi'm coming from an MS-Access world
thumbsmrpackethead: ok, and?
mrpacketheadwhere i was able to make a table and say this feild is a lookup on another table
thumbsmrpackethead: ok
mrpacketheadand it would present a table essentially with a drop down list of possible values
mrpacketheadi' was trying to do essentially the same thing
thumbsmrpackethead: forget about drop-downs. Just use a FK reference to the other table.
mrpacketheadbut it seems it wont' force having to use one of the values
thumbsmrpackethead: see my comment about check constraints