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? |
snoyes | if there is no difference, then what does it matter which one changes? Just put a LIMIT 1 on there. |
passage | me_: 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_bot | me_: Arjen's rule#1: A relational database is NOT a spreadsheet. |
sisve | ubiquity_bot: not even Excel with multi-sheets? ;) |
me_ | passage: thanks for explanation. |
gwozt | join #english |
aungkhantmin | hi |
aungkhantmin | hello guys any one > |
snoyes | !t aungkhantmin ask |
ubiquity_bot | aungkhantmin: 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: http://workaround.org/getting-help-on-irc |
aungkhantmin | ok bro |
aungkhantmin | i am having porblem when reading our university text book, An Introduction to database system by C J Date, |
aungkhantmin | six edition |
aungkhantmin | In that Text book The query are not same With mysql tutorial on W3Schools |
aungkhantmin | Did we still use the query from the text book ? |
snoyes | What are the two queries? |
aungkhantmin | (S JOIN SP ) WHERE P# = ‘P2’ ) [S#, CITY] |
aungkhantmin | that is the query in text book |
aungkhantmin | ( (COLUMS WHERE COLNAME = ‘EMP#’) [TABNAME] |
aungkhantmin | If we use this command in mysql console |
aungkhantmin | we got error |
archivist | replace with names you want and are using |
snoyes | There are many database systems, and while they generally follow the same principles, they implement the syntax a little bit differently in each. |
snoyes | The 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. |
snoyes | MySQL, SQL Server, PostgreSQL, Access, will all be a little different |
aungkhantmin | So , Is it just like a pusedo code ? |
aungkhantmin | May i know what is the DBMS for this type of syntax SQL Server ? |
snoyes | I doubt there is any database that implements exactly the syntax shown in the text book. |
aungkhantmin | ok Bro Tnx You |
aungkhantmin | Now i can realize and continue reading |
qakhan | hi all, i am using following query to get a count of groups of values . http://pastebin.com/7dnDBU3M |
qakhan | and i have an order group userfield ('C2D-EXTEN','C2D-PH') which count i need to take. |
qakhan | how can i inclide userfield IN ('C2D-EXTEN','C2D-PH') and userfield IN ('D2C-EXTEN','Call-Out') in single query |
snoyes | SUM(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') |
aungkhantmin | guys i am confusing with this query CREAETE SNAPSHOT SC AS ( ( S JOIN SP) WHERE P# = ‘p2’ ) (S#, CITY) REFRESH EVERY DAY ) |
aungkhantmin | I am struggle in ( S# , CITY) |
snoyes | none of that is MySQL syntax. |
aungkhantmin | Yes i am asking logic |
aungkhantmin | I can figure out the out put table |
qakhan | Thanks snoyes it working. |
Xgc | aungkhantmin: 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. |
aungkhantmin | Ok |
Xgc | aungkhantmin: First decide which channel to join based on the database you are using. |
aungkhantmin | okay |
Xgc | aungkhantmin: They all support significantly different forms of SQL. |
gamelaster | Hello! 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? |
snoyes | ALTER TABLE tblname ADD UNIQUE(userid, timestamp); |
gamelaster | #1062 - Duplicate entry '100004XXX005986-2017-03-04 04:31:01' :-/ |
gamelaster | How to force that it will automatically delete all duplicates? |
gamelaster | ALTER IGNORE TABLE presences ADD UNIQUE INDEX activity(userid, timestamp); |
gamelaster | this doing same |
sisve | gamelaster: "INSERT ... ON DUPLICATE KEY IGNORE" *guessing* |
gamelaster | okay, thank you guys! |
salle_ | gamelaster: Adding proper unique constraint is the right way to do it |
gamelaster | salle_ 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 ;) |
gamelaster | salle_ : yeah! |
ekh | Hello. 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) |
snoyes | diff databases on the same server, or in different serves? |
ekh | diff in same LAN. |
snoyes | move them all to one server (mysqldump and import, or use TTS), and then do some INSERT...SELECT to put them together. |
ekh | this 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 t1.id>t2.id AND t1.name=t2.name; 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 http://bugs.mysql.com/bug.php?id=28837 |
ekh | extend more join, or extend the "ON" clause? |
Xgc | ekh: Depends on how those fields matter. Normally, adjust the join condition. |
mrpackethead | I 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 |
thumbs | mrpackethead: fields using values? what? |
thumbs | mrpackethead: or are you just trying to define a FK to the other table? |
thumbs | mrpackethead: if you want a check contraint, you'll have to use triggers since MySQL doesn't implement those. |
mrpackethead | thums.. whats a FK? |
thumbs | mrpackethead: foreign key. |
mrpackethead | ahh |
mrpackethead | i did set up FK's |
thumbs | mrpackethead: so what's the problem? |
mrpackethead | thumbs.. problem is the constraints |
mrpackethead | i did'nt know how to do that |
thumbs | mrpackethead: for check constraints, use a trigger. |
mrpackethead | i'm coming from an MS-Access world |
thumbs | mrpackethead: ok, and? |
mrpackethead | where i was able to make a table and say this feild is a lookup on another table |
thumbs | mrpackethead: ok |
mrpackethead | and it would present a table essentially with a drop down list of possible values |
mrpackethead | i' was trying to do essentially the same thing |
thumbs | mrpackethead: forget about drop-downs. Just use a FK reference to the other table. |
mrpackethead | but it seems it wont' force having to use one of the values |
thumbs | mrpackethead: see my comment about check constraints |