How can I pull a list of ID’s from a SQL table as a comma-separated values string?

MySQL SELECT GROUP_CONCAT(t.prodid SEPARATOR ‘,’) FROM PRODUCTS t WHERE t.prodtype=”XYZ” Oracle: There is an excellent summary of the available string aggregation techniques on Tim Hall’s site. SQL Server 2005+ SELECT STUFF((SELECT ‘,’+ t.prodid FROM PRODUCTS t WHERE t.prodtype=”XYZ” FOR XML PATH(”)), 1, 1, ”)

Looking for an embeddable SQL beautifier or reformatter [closed]

UPDATE 2: org.hibernate.jdbc.util.BasicFormatterImpl got moved in release 4.0. It is now located at: org.hibernate.engine.jdbc.internal.BasicFormatterImpl. UPDATE 1: Technology marches on. As noted by Alex, org.hibernate.pretty.Formatter no longer exists as of version 3.3.2.GA. The replacement is org.hibernate.jdbc.util.BasicFormatterImpl: String formattedSQL = new BasicFormatterImpl().format(sql); ORIGINAL ANSWER: If you’re using Hibernate, they’ve got one built-in: org.hibernate.pretty.Formatter String formattedSQL = new … Read more

How to quickly generate SELECT statement for a table in DataGrip?

In DataGrip as other intellij-based IDEs everything is about source editing. So that can be achieved that way: Open console Start typing sel, you’ll get completion popup (if not, hit Ctrl+Space) Select sel here, which is live-template for select statement Select statement will be generated, asking for table name and column list Select desired table … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)