Created
May 5, 2013 15:02
-
-
Save sposmen/5521051 to your computer and use it in GitHub Desktop.
Table emulation in postgres and mysql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM | |
( | |
SELECT 'juan' AS data UNION | |
SELECT 'carlos' AS data UNION | |
SELECT 'pepito' AS data UNION | |
SELECT 'mauro' AS data | |
) AS tmp_names | |
WHERE | |
-- Compare data with a real table | |
dato NOT IN (SELECT name FROM tbl_names) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT ( | |
'{{"DG54362","13668"}, | |
{"SCCC114952","1125137"}, | |
{"SCCC108226","35860"}, | |
{"SCCC48986","37257"}, | |
{"SCCC155903","9790"}}'::varchar[][])[foo][1] AS nrofactura, | |
('{{"DG54362","13668"}, | |
{"SCCC126619","37180"}, | |
{"SCCC126622","10018"}, | |
{"SCCC137446","169620"}, | |
{"SCCC155903","9790"}}'::varchar[][])[foo][2] AS valorfactura | |
FROM | |
generate_series(1,5) AS foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment