Jump to content

tommo74

Members
  • Posts

    10
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

tommo74's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I'm stuck on a query for a while now, maybe somebody could help. If I have two tables, say Table1 and Table2, and they both have a column called Code. I want to select everything from Table1 where there is data in the Code column in Table1 that is'nt in the Code column in Table2. For example if all the data is the same in both columns except Table 1 has one entry in the Code column thats not in the Table2 Code column, how would I select that one row from Table1 ? Thanks
  2. I want to add a column to a table that holds datatype INT with a default of 0 and the maximum digits allowed in the column is 3. This : ALTER TABLE Person ADD Age INT(3) DEFAULT 0; gives the following error : ERROR: parser: parse error at or near "(" at character 31 Any help ?
  3. If I do a select length(name) as length from User and get : length | --------+ | 0 | (2 rows) Does that mean that one of the rows is null and the other one has a value of '' ?
  4. I ended up using this which works fine: select name, id from aadetails where id in(select id from aadetails group by id having count(*)>1) order by name;
  5. Yes, it appears that you are right about that. Sorry I should have mentioned I'm using Oracle.
  6. Thanks, when I try and run the query it gives the following error: Error starting at line 1 in command: SELECT id , GROUP_CONCAT(name ORDER BY name SEPARATOR ', ') as names FROM aadetails GROUP BY id HAVING COUNT(*) > 1 Error at Command Line:1 Column:30 Error report: SQL Error: ORA-00907: missing right parenthesis I've tried playing around with the parenthesis but nothing doing.
  7. I have a table called AADETAILS with two colums ('Name' and 'ID'). The ID column is not supposed to have any duplicates, so I need a query that returns a list of all the duplicate ID's (with their Name). For example, if there is an ID with a value of 123 duplicated three times and an ID with a value of 456 duplicated four times, I need a list of the Name and ID of the three instances of 123 and the four instances of 456. I have the following : SELECT Name, ID FROM AADETAILS GROUP BY Name, ID HAVING COUNT(ID) > 1 its not returning anything, but it should (I can see the duplicates in the table if I view all the data in it), whats wrong with that query ? Thanks
  8. Thats it, length() works fine in my situation, thanks guys.
  9. If I've got a table with a column of Surnames, is there any way to select all the surnames that are shorter than 5 letters long. I know I could return ALL the surnames in a result set and go through the result set to check the length of each one individually, but is there a query where I could return just the Surnames shorter than 5 letters ?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.